/* ═══════ Profile ═══════ */
.profile__avatar-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile__avatar-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.profile__avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
}
.profile__avatar--img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-border); }
.profile__avatar-overlay {
  position: absolute; bottom: 0; right: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; border: 2px solid #fff; transition: transform .15s;
}
.profile__avatar-wrap:hover .profile__avatar-overlay { transform: scale(1.15); }
.profile__user-name { font-weight: 600; font-size: 15px; }
.profile__user-email { font-size: 13px; color: var(--color-text-muted); }
.profile__user-role { font-size: 11px; background: var(--color-bg-secondary); padding: 2px 8px; border-radius: 4px; }
.profile__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .profile__grid { grid-template-columns: 1fr; } }
.profile__card-icon { margin-right: 8px; color: var(--color-primary); }
.profile-modal__avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 700; }
.profile-modal__avatar--img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-border); }

/* ═══════ KM (Knowledge Management) ═══════ */
.page-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-text-muted); margin: 8px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.filters-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.km-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  border-radius: 12px; padding: 32px; color: #fff; margin-bottom: 24px; text-align: center;
}
.km-hero__title { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; color: #fff; }
.km-hero__subtitle { opacity: .85; font-size: 13px; margin-bottom: 20px; }
.km-hero__search { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.km-hero__input {
  flex: 1; padding: 12px 16px; border-radius: 8px;
  border: none; font-size: 14px; outline: none; color: var(--color-text);
}
.km-hero__btn {
  padding: 12px 20px; background: #fff; color: var(--color-primary);
  border: none; border-radius: 8px; font-weight: 700; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; gap: 6px;
}
.km-hero__btn:hover { background: var(--color-primary-light); }
.km-hero__chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.km-chip {
  padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.2);
  color: #fff; font-size: 12px; cursor: pointer; border: none;
  transition: background .15s ease;
}
.km-chip:hover { background: rgba(255,255,255,.35); }

.km-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.km-stat {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 16px; text-align: center;
}
.km-stat__val { font-size: 22px; font-weight: 700; color: var(--color-primary); }
.km-stat__lbl { font-size: 11px; color: var(--color-text-muted); margin-top: 3px; }
.km-stat__unit { font-size: 14px; color: var(--color-text-muted); font-weight: 500; }

.km-section-title {
  font-size: 13px; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.km-section-title > span:first-of-type { flex: 1; }
.km-section-title__count { font-size: 11px; color: var(--color-text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.km-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.km-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 16px; cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.km-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); border-color: var(--color-primary); }
.km-card__meta { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.km-card__title { font-weight: 600; font-size: 13px; margin-bottom: 6px; line-height: 1.4; color: var(--color-text); }
.km-card__desc {
  font-size: 12px; color: var(--color-text-muted); line-height: 1.5; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.km-card__footer { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--color-text-muted); flex-wrap: wrap; }
.km-card__footer > span { display: flex; align-items: center; gap: 3px; }
.km-card__score {
  margin-left: auto; background: var(--color-primary-light); color: var(--color-primary);
  padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
}

@media (max-width: 1024px) {
  .km-grid { grid-template-columns: repeat(2, 1fr); }
  .km-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .km-grid { grid-template-columns: 1fr; }
  .km-stats { grid-template-columns: 1fr; }
  .km-hero { padding: 20px; }
  .km-hero__search { flex-direction: column; }
}

/* ═══════ Table (for KM + simple pages) ═══════ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 12px; text-align: left; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border); background: var(--color-bg); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--color-bg); }

/* ═══════ Icon button ═══════ */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: transparent; border: 1px solid var(--color-border);
  color: var(--color-text-muted); cursor: pointer; margin: 0 2px;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--color-bg); color: var(--color-text); }
.icon-btn--danger:hover { background: #fee2e2; color: var(--color-danger); border-color: var(--color-danger); }
.icon-btn--success { color: var(--color-success); border-color: var(--color-success); }
.icon-btn--success:hover { background: #dcfce7; }

/* ═══════ AI Test Result ═══════ */
.ai-test-result { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.ai-test-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 8px; font-size: 13px;
}
.ai-test-row--ok { background: #dcfce7; color: #166534; }
.ai-test-row--ok > i { color: var(--color-success); font-size: 18px; margin-top: 1px; }
.ai-test-row--err { background: #fee2e2; color: #991b1b; }
.ai-test-row--err > i { color: var(--color-danger); font-size: 18px; margin-top: 1px; }
.ai-test-row code { background: rgba(0,0,0,.08); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.ai-test-meta { font-size: 11px; margin-top: 3px; opacity: .85; }
.ai-test-meta--err { word-break: break-word; }

/* ═══════ Right Drawer (PM + generic) ═══════ */
.rightbar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25); z-index: 150;
  display: flex; justify-content: flex-end;
}
.rightbar {
  width: 520px; max-width: 100vw; height: 100vh;
  background: var(--color-surface); display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  animation: rightbar-in .25s ease;
}
@keyframes rightbar-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

.rightbar__header {
  padding: 16px 20px; border-bottom: 1px solid var(--color-border);
  background: var(--color-bg); display: flex; align-items: flex-start; gap: 12px;
}
.rightbar__title { font-weight: 700; font-size: 15px; }
.rightbar__subtitle { font-size: 12px; color: var(--color-text-muted); margin-top: 3px; }

.rightbar__tabs { display: flex; border-bottom: 1px solid var(--color-border); background: var(--color-surface); overflow-x: auto; }
.rightbar__tab {
  padding: 12px 16px; font-size: 12px; font-weight: 500;
  border: none; background: transparent; cursor: pointer;
  color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.rightbar__tab--active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

.rightbar__body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.rightbar__empty { padding: 24px; text-align: center; color: var(--color-text-muted); font-size: 13px; }
.rightbar__add {
  margin-top: 14px; padding: 12px; background: var(--color-bg);
  border-radius: 8px; border: 1px dashed var(--color-border);
}

/* ── Info rows ── */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row__label { color: var(--color-text-muted); }
.info-row__val { font-weight: 600; }

/* ── Task list ── */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; background: var(--color-bg);
  border-radius: 8px; margin-bottom: 6px;
}
.task-item__seq {
  width: 22px; height: 22px; background: var(--color-primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.task-item__body { flex: 1; }
.task-item__desc { font-size: 13px; line-height: 1.4; }
.task-item__meta { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }

.asset-link-list, .freq-list, .sched-list { list-style: none; padding: 0; margin: 0; }
.asset-link-item, .freq-item, .sched-item {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--color-bg);
  border-radius: 8px; margin-bottom: 6px;
}
.asset-link-item > i, .freq-item > i { color: var(--color-primary); }
.sched-item__date { font-weight: 700; font-size: 12px; width: 90px; color: var(--color-text); }
.sched-item__main { flex: 1; }

/* ═══════ PM Calendar ═══════ */
.pm-cal { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .pm-cal { grid-template-columns: 1fr 320px; } }

.pm-cal__grid {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; overflow: hidden;
}
.pm-cal__head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--color-bg); border-bottom: 1px solid var(--color-border); }
.pm-cal__head-cell { padding: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); text-align: center; }
.pm-cal__body { display: grid; grid-template-columns: repeat(7, 1fr); }
.pm-cal__cell {
  min-height: 100px; padding: 6px 8px;
  border-right: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border);
  text-align: left; background: var(--color-surface); cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  border-top: none; border-left: none;
}
.pm-cal__cell:hover { background: var(--color-bg); }
.pm-cal__cell--empty { background: var(--color-bg); cursor: default; }
.pm-cal__cell--today .pm-cal__date {
  background: var(--color-primary); color: #fff; border-radius: 999px; padding: 2px 8px;
}
.pm-cal__cell--selected { background: var(--color-primary-light); }
.pm-cal__date { font-size: 12px; font-weight: 600; display: inline-block; }
.pm-cal__event {
  font-size: 10px; padding: 2px 6px; background: #fff;
  border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.pm-cal__more { font-size: 10px; color: var(--color-text-muted); }

.pm-cal__detail {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 14px; align-self: start;
}
.pm-cal__detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--color-border); }

/* ═══════ Asset Picker (bulk) ═══════ */
.asset-picker__list {
  max-height: 420px; overflow-y: auto;
  border: 1px solid var(--color-border); border-radius: 8px;
  background: var(--color-surface);
}
.asset-picker__row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--color-border);
  cursor: pointer; transition: background .15s ease;
}
.asset-picker__row:last-child { border-bottom: none; }
.asset-picker__row:hover { background: var(--color-bg); }
.asset-picker__row--on { background: var(--color-primary-light); }
.asset-picker__row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); flex-shrink: 0; }

.row--picked td { background: var(--color-primary-light) !important; }


/* ═══════════════════════════
   Work Orders / Assets Drawer
   ═══════════════════════════ */
.wo-actions { display: flex; gap: 4px; justify-content: flex-end; }
.wo-filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.wo-filter-bar .form-input--sm { min-width: 0; flex: 1 1 120px; max-width: 200px; }
.wo-filter-bar__sep { color: var(--color-text-muted); font-size: 12px; padding: 0 2px; }

.wo-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 400; display: flex; justify-content: flex-end;
}
.wo-drawer {
  width: 520px; max-width: 95vw; height: 100%;
  background: var(--color-surface, #fff);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  animation: wo-drawer-slide 0.2s ease;
}
@keyframes wo-drawer-slide {
  from { transform: translateX(100%); } to { transform: translateX(0); }
}
.wo-drawer__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--color-border); gap: 12px;
}
.wo-drawer__title { font-weight: 700; font-size: 16px; color: var(--color-text); }
.wo-drawer__subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }

.wo-drawer__tabs {
  display: flex; border-bottom: 1px solid var(--color-border);
  padding: 0 12px; gap: 0; overflow-x: auto;
}
.wo-drawer__tab {
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--color-text-muted);
  background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  margin-bottom: -1px; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.wo-drawer__tab:hover { color: var(--color-text); }
.wo-drawer__tab--active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.wo-drawer__body { flex: 1; overflow-y: auto; padding: 16px 20px; }

.wo-info { display: flex; flex-direction: column; gap: 10px; }
.wo-info-row { display: flex; gap: 12px; font-size: 13px; }
.wo-info-row__label { width: 130px; flex-shrink: 0; color: var(--color-text-muted); font-weight: 500; }
.wo-info-row__value { flex: 1; color: var(--color-text); }
.wo-info-desc { margin-top: 8px; font-size: 13px; }
.wo-info-desc p { margin: 4px 0 0; color: var(--color-text); line-height: 1.5; }

.wo-sub-panel { display: flex; flex-direction: column; gap: 14px; }
.wo-sub-panel__add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wo-sub-panel__add--row { align-items: center; }

.wo-sub-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.wo-sub-table th, .wo-sub-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--color-border); }
.wo-sub-table th {
  font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; font-size: 11px; background: var(--color-bg-alt);
}
.wo-close-done {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #dcfce7; color: #166534;
  border-radius: var(--radius, 6px);
  font-size: 13px; font-weight: 500; margin-bottom: 8px;
}

/* ═══════════════════════════
   Notifications Bell
   ═══════════════════════════ */
.notif-bell { position: relative; margin-right: 8px; }
.notif-bell__badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--color-danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 5px; min-width: 16px;
  border-radius: 8px; text-align: center; line-height: 14px;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-height: 480px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
  z-index: 500; display: flex; flex-direction: column;
}
.notif-panel__head {
  padding: 10px 14px; font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-panel__body { flex: 1; overflow-y: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.notif-item--unread { background: rgba(37,99,235,0.04); }
.notif-item--danger { border-left: 3px solid var(--color-danger); }
.notif-item--warning { border-left: 3px solid var(--color-warning); }
.notif-item--info { border-left: 3px solid var(--color-primary); }
.notif-item--success { border-left: 3px solid var(--color-success); }
.notif-item__title { font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.notif-item__body { color: var(--color-text-muted); font-size: 12px; margin-bottom: 4px; }
.notif-item__meta { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--color-text-muted); }
.notif-item__mark { margin-left: auto; background: none; border: none; color: var(--color-primary); cursor: pointer; font-size: 11px; }

.crud-page__table-area { margin-top: 0; }

/* ═══════ Dashboard chart layout ═══════ */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.dash-chart-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.dash-chart--full { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .dash-grid, .dash-chart-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════
   Mobile Asset View (QR scan)
   ═══════════════════════════ */
.m-asset {
  max-width: 640px; margin: 0 auto; padding: 12px;
  min-height: 100vh; background: var(--color-bg, #f8fafc);
}
.m-asset__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px; background: var(--color-primary);
  color: #fff; border-radius: 10px; margin-bottom: 12px;
}
.m-asset__back {
  color: #fff; text-decoration: none;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.2); border-radius: 6px;
}
.m-asset__code { font-weight: 700; font-size: 14px; opacity: .9; }
.m-asset__name { font-size: 17px; font-weight: 600; }
.m-asset__card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.m-asset__section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--color-text-muted); margin-bottom: 10px;
  letter-spacing: .04em;
}
.m-asset__row {
  display: flex; padding: 6px 0;
  border-bottom: 1px dashed var(--color-border); font-size: 13px;
}
.m-asset__row:last-child { border-bottom: none; }
.m-asset__row-label { width: 110px; flex-shrink: 0; color: var(--color-text-muted); }
.m-asset__row-value { flex: 1; }
.m-asset__wo {
  padding: 10px; margin-bottom: 8px;
  background: var(--color-bg-alt); border-radius: 6px;
}
.m-asset__actions {
  position: sticky; bottom: 12px;
  display: flex; gap: 8px; padding-top: 8px;
}

/* ═══════════════════════════
   Reports page layout
   ═══════════════════════════ */
.reports-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.reports-menu { display: flex; flex-direction: column; gap: 6px; }
.reports-menu__item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; background: var(--color-surface, #fff);
  border: 1px solid var(--color-border); border-radius: 8px;
  cursor: pointer; text-align: left; color: var(--color-text);
  transition: background .15s, border-color .15s;
}
.reports-menu__item > i { padding-top: 3px; color: var(--color-text-muted); }
.reports-menu__item:hover { background: var(--color-bg-alt); }
.reports-menu__item--active { border-color: var(--color-primary); background: rgba(37,99,235,0.05); }
.reports-menu__item--active > i { color: var(--color-primary); }
.reports-menu__title { font-weight: 600; font-size: 14px; }
.reports-menu__desc { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; line-height: 1.4; }

.reports-main { min-width: 0; }
.reports-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.reports-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin: 0; }
.reports-subtitle { color: var(--color-text-muted); font-size: 12px; margin-top: 2px; }
.reports-actions { display: flex; gap: 6px; }

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

/* ═══════════════════════════
   Analytics KPIs
   ═══════════════════════════ */
.analytics-grid {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.analytics-kpi {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--color-surface, #fff);
  border: 1px solid var(--color-border); border-radius: 10px;
}
.analytics-kpi__icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.analytics-kpi__label { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.analytics-kpi__value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.analytics-kpi__sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

.analytics-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border); border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.analytics-card__title {
  font-weight: 600; font-size: 13px; text-transform: uppercase;
  color: var(--color-text-muted); margin-bottom: 12px; letter-spacing: .04em;
}

/* ═══════════════════════════
   DatePicker overrides
   ═══════════════════════════ */
.react-datepicker-wrapper { display: block; }
.react-datepicker-wrapper .form-input--sm { height: 32px; font-size: 13px; padding: 4px 10px; }
.react-datepicker__header { background: var(--color-primary) !important; color: #fff; }
.react-datepicker__current-month,
.react-datepicker__day-name { color: #fff !important; }
.react-datepicker__day--selected,
.react-datepicker__day--keyboard-selected { background: var(--color-primary) !important; }
.react-datepicker__close-icon::after { background: var(--color-danger) !important; }
.react-datepicker { font-family: inherit !important; border-color: var(--color-border) !important; }

/* ═══════════════════════════
   Clickable rows
   ═══════════════════════════ */
.data-table__row--clickable { cursor: pointer; }
.data-table__row--clickable:hover { background: rgba(37,99,235,0.06) !important; }

/* ═══════════════════════════
   PM Gantt Chart
   ═══════════════════════════ */
.gantt-wrapper {
  overflow-x: auto; border: 1px solid var(--color-border); border-radius: 10px;
  background: #fff; margin-top: 8px;
}
.gantt-container { position: relative; min-height: 200px; }

.gantt-header {
  display: flex; position: sticky; top: 0; z-index: 3;
  background: var(--color-bg-secondary); border-bottom: 2px solid var(--color-border);
  font-size: 12px; font-weight: 600;
}
.gantt-label-col {
  width: 280px; min-width: 280px; padding: 8px 12px;
  border-right: 1px solid var(--color-border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 12px;
}
.gantt-label-col--plan { font-weight: 600; background: var(--color-bg-secondary); }
.gantt-label-col--asset { padding-left: 28px; color: var(--color-text-muted); }
.gantt-timeline { position: relative; flex: 1; height: 34px; }
.gantt-timeline--bg { height: 30px; }

.gantt-month-header {
  position: absolute; top: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--color-border);
  font-size: 11px; font-weight: 600; color: var(--color-text-muted);
}

.gantt-group-row {
  display: flex; border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}
.gantt-row {
  display: flex; border-bottom: 1px solid rgba(0,0,0,.04);
}
.gantt-row:hover { background: rgba(37,99,235,0.04); }

.gantt-day-cell {
  position: absolute; top: 0; width: 28px; height: 100%;
  border-right: 1px solid rgba(0,0,0,.04);
  box-sizing: border-box;
}
.gantt-day-cell--today { background: rgba(37,99,235,0.08); }

.gantt-bar {
  position: absolute; top: 6px; width: 22px; height: 18px;
  border-radius: 4px; cursor: pointer; opacity: 0.9;
}
.gantt-bar:hover { opacity: 1; transform: scale(1.15); z-index: 2; }

.gantt-today {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--color-danger); z-index: 2; opacity: 0.5;
}

/* ═══════ Searchable Select ═══════ */
.ss { position: relative; width: 100%; }
.ss__display {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; cursor: pointer; text-align: left; background: #fff;
  min-height: 36px;
}
.ss__display:disabled { background: var(--color-bg-muted); cursor: not-allowed; }
.ss__selected { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ss__selected-main { font-weight: 500; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss__selected-sub { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss__placeholder { color: var(--color-text-muted); }
.ss__actions { display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); font-size: 11px; }
.ss__clear { cursor: pointer; padding: 2px 6px; border-radius: 3px; }
.ss__clear:hover { background: var(--color-danger-bg, #fef2f2); color: var(--color-danger); }
.ss__chevron { font-size: 10px; }

.ss__input { width: 100%; }
.ss__list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: #fff; border: 1px solid var(--color-border); border-radius: 6px;
  max-height: 280px; overflow-y: auto; margin-top: 4px;
  list-style: none; padding: 4px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ss__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
}
.ss__item--active { background: var(--color-bg-muted); }
.ss__item--selected { background: rgba(37,99,235,0.08); }
.ss__item-icon { color: var(--color-text-muted); width: 14px; text-align: center; }
.ss__item-text { flex: 1; min-width: 0; }
.ss__item-label { font-size: 13px; font-weight: 500; color: var(--color-text); }
.ss__item-sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.ss__highlight { color: var(--color-primary); background: rgba(37,99,235,0.12); padding: 0 2px; border-radius: 2px; }
.ss__empty { padding: 16px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* ═══════ Attachments — Dropzone + Gallery + Lightbox ═══════ */
.attach-panel { padding: 8px 0; }

.attach-dropzone {
  border: 2px dashed var(--color-border); border-radius: var(--radius-lg);
  padding: 24px; text-align: center; cursor: pointer;
  color: var(--color-text-muted); font-size: 13px;
  transition: border-color .2s, background .2s;
  margin-bottom: 12px;
}
.attach-dropzone:hover, .attach-dropzone--active {
  border-color: var(--color-primary); background: rgba(37,99,235,0.04);
  color: var(--color-primary);
}
.attach-dropzone__icon {
  display: block; font-size: 28px; margin-bottom: 8px; opacity: .6;
}
.attach-dropzone--active .attach-dropzone__icon { opacity: 1; }

/* Gallery grid */
.attach-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px; margin-bottom: 12px;
}
.attach-gallery__item {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-md);
  overflow: hidden; cursor: pointer; border: 1px solid var(--color-border);
  transition: box-shadow .15s;
}
.attach-gallery__item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.attach-gallery__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.attach-gallery__remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  font-size: 10px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.attach-gallery__item:hover .attach-gallery__remove { opacity: 1; }

/* File rows */
.attach-files { display: flex; flex-direction: column; gap: 4px; }
.attach-files__row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: #fff;
}
.attach-files__icon { font-size: 18px; color: var(--color-text-muted); width: 22px; text-align: center; }
.attach-files__info { flex: 1; min-width: 0; }
.attach-files__name {
  font-size: 13px; font-weight: 500; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
a.attach-files__name:hover { color: var(--color-primary); }
.attach-files__meta { font-size: 11px; color: var(--color-text-muted); }

/* Fullscreen lightbox */
.attach-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.88); display: flex;
  align-items: center; justify-content: center;
  animation: fadeIn .15s;
}
.attach-lightbox__img {
  max-width: 92vw; max-height: 90vh; object-fit: contain;
  border-radius: 6px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.attach-lightbox__close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; border: none;
  font-size: 18px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.attach-lightbox__close:hover { background: rgba(255,255,255,.3); }
.attach-lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; border: none;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.attach-lightbox__nav:hover { background: rgba(255,255,255,.25); }
.attach-lightbox__nav--prev { left: 16px; }
.attach-lightbox__nav--next { right: 16px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ═══════ WO Approval Bar ═══════ */
.wo-drawer__approval-bar {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 16px; background: #fff;
  border-top: 2px solid var(--color-warning);
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.btn--danger { background: var(--color-danger); color: #fff; border: none; }
.btn--danger:hover { opacity: .9; }
