/* ═══════════════════════════════════════════════════════════════
   ACCESS DEFENDER PRO — COMPONENTS v2
   Requires: tokens.css
   All values reference design tokens. No magic numbers.
   ═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────
   RESET & BASE
   ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  color: var(--ms-text-primary);
  background: var(--ms-bg-page);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ms-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────────────────
   GLOBAL FOCUS RING — all interactive elements
   ────────────────────────────────────────────────────────── */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — pixel-perfect, every spacing identical
   ═══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--ms-bg-main);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--sidebar-collapse-speed) ease;
  overflow: hidden;
}
.sidebar.collapsed,
html.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}

/* ── Brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-4);
  height: var(--topbar-height);
  background: linear-gradient(180deg, #3B8F62 0%, #2E7D5A 60%, #1E5C42 100%);
  border-bottom: 2px solid #0F3020;
  flex-shrink: 0;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.sidebar-brand::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 0.4px, transparent 0.4px, transparent 60px);
  pointer-events: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-text {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.25);
  position: relative; z-index: 1;
}
.sidebar-brand-sub {
  font-size: 10px;
  font-weight: var(--weight-normal);
  color: rgba(255,255,255,0.65);
  display: block;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-1) 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #D0D0D0; border-radius: 2px; }

/* ── Section label — identical spacing everywhere ── */
.sidebar-section-label {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #707070;
  padding: 20px var(--space-4) 4px;
  white-space: nowrap;
  overflow: hidden;
  border-top: 1px solid #F0F0F0;
  margin-top: var(--space-2);
}
.sidebar-section-label:first-child {
  border-top: none;
  margin-top: 0;
}

/* ── Nav items — identical spacing everywhere ── */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-4);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
  position: relative;
  white-space: nowrap;
  border-left: 2px solid transparent;
}
.sidebar-item:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text);
  text-decoration: none;
  border-left-color: #C0C0C0;
}
.sidebar-item.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-active-text);
  font-weight: var(--weight-semibold);
  border-left: 2px solid var(--sidebar-active-indicator);
}

/* ── Icon — every sidebar icon is exactly 16×16px ── */
.sidebar-item-icon {
  width: var(--sidebar-icon-size);
  height: var(--sidebar-icon-size);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Label ── */
.sidebar-item-label {
  overflow: hidden;
  transition: opacity var(--sidebar-collapse-speed) ease;
}

/* ── Badge — identical alignment everywhere ── */
.sidebar-badge {
  margin-left: auto;
  background: #D13438;
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  line-height: 1.4;
}

/* ── Collapse states — smooth animation ── */
.sidebar.collapsed .sidebar-item-label,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-brand-sub,
.sidebar.collapsed .sidebar-badge,
.sidebar.collapsed .sidebar-search { display: none !important; }
.sidebar.collapsed .sidebar-item-icon { margin: 0; }
.sidebar.collapsed .sidebar-section-label { opacity: 0; height: 0; padding: 0; margin: 0; border: none; overflow: hidden; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 0 var(--space-1); }
.sidebar.collapsed .sidebar-search-row { justify-content: center; padding: var(--space-2) 0; }
.sidebar.collapsed .sidebar-item { justify-content: center; padding: 10px 0; }

html.sidebar-collapsed .sidebar-item { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .sidebar-item-icon { margin: 0; }
html.sidebar-collapsed .sidebar-item-label,
html.sidebar-collapsed .sidebar-section-label,
html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .sidebar-brand-sub,
html.sidebar-collapsed .sidebar-badge,
html.sidebar-collapsed .sidebar-search { display: none !important; }
html.sidebar-collapsed .sidebar-section-label { opacity: 0; height: 0; padding: 0; margin: 0; border: none; overflow: hidden; }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0 var(--space-1); }
html.sidebar-collapsed .sidebar-search-row { justify-content: center; padding: var(--space-2) 0; }

/* ── Footer ── */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: var(--space-2) 0;
  flex-shrink: 0;
}

/* ── Search row ── */
.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  flex-shrink: 0;
}
.sidebar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-3);
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  flex: 1;
  min-width: 0;
}
.sidebar-search:focus-within {
  border-color: var(--ms-brand);
  box-shadow: var(--shadow-xs);
}
.sidebar-search svg {
  width: 14px; height: 14px;
  stroke: var(--ms-text-muted);
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}
.sidebar-search input {
  border: none; background: transparent;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  outline: none; width: 100%;
}
.sidebar-search input::placeholder { color: var(--ms-text-muted); }

/* ── Sidebar toggle ── */
.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0;
  background: #F3F2F1;
  border: 1px solid #D0D0D0;
  border-radius: var(--radius-sm);
  cursor: pointer; color: #707070;
  transition: background 0.12s ease;
}
.sidebar-toggle:hover { background: #E0E0E0; color: #1A1A1A; }
.sidebar-toggle svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 2;
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR — Microsoft Defender style
   ═══════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: var(--z-topbar);
  transition: left var(--sidebar-collapse-speed) ease;
}
.topbar.collapsed,
html.sidebar-collapsed .topbar {
  left: var(--sidebar-width-collapsed);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ms-text-muted);
}
.topbar-breadcrumb .current {
  color: var(--ms-text-primary);
  font-weight: var(--weight-medium);
}
.topbar-breadcrumb .sep { color: var(--ms-border); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Topbar environment badge ── */
.topbar-env-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.topbar-env-badge.production { background: #E8F5E8; color: #2E7D5A; border-color: #A8D8B8; }
.topbar-env-badge.demo       { background: #EBF4FB; color: #1E5A9C; border-color: #D6E8F5; }
.topbar-env-badge.development { background: #FFF8E8; color: #835B00; border-color: #F5D78E; }

/* ── Topbar snapshot / sync status ── */
.topbar-snapshot-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--ms-text-muted);
}
.topbar-snapshot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: #F8FBF9;
  border: 1px solid var(--ms-border);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.topbar-snapshot-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar-snapshot-status .dot.ready { background: #2E7D5A; }
.topbar-snapshot-status .dot.running {
  background: #1E5A9C;
  animation: pulse-dot 1.4s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Topbar search ── */
.topbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  padding: 5px var(--space-3);
  width: 240px;
  transition: var(--transition-base);
}
.topbar-search:focus-within {
  border-color: var(--ms-brand);
  box-shadow: var(--shadow-xs);
}
.topbar-search svg {
  width: 14px; height: 14px;
  stroke: var(--ms-text-muted);
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}
.topbar-search input {
  border: none; background: transparent;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  outline: none; width: 100%;
}
.topbar-search input::placeholder { color: var(--ms-text-muted); }

/* ── Topbar user ── */
.topbar-user {
  display: flex; align-items: center; gap: var(--space-2);
  cursor: pointer; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  position: relative;
}
.topbar-user:hover { background: var(--wd-green-tint); }
.topbar-avatar {
  width: 28px; height: 28px; border-radius: var(--radius-round);
  background: linear-gradient(135deg, var(--wd-green-1), var(--wd-green-3));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: var(--weight-semibold);
  color: #fff; flex-shrink: 0;
}
.topbar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ms-text-primary);
}

/* ── Icon button ── */
.icon-btn {
  width: 32px; height: 32px; border: none; background: transparent;
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--ms-text-muted);
  transition: var(--transition-base); position: relative;
}
.icon-btn:hover { background: #F3F2F1; color: var(--ms-text-primary); }
.icon-btn svg {
  width: var(--icon-md); height: var(--icon-md);
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn .notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; background: var(--ms-error);
  border-radius: var(--radius-round); border: 1.5px solid #fff;
}

/* ── Sync button in topbar ── */
.topbar-sync {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.topbar-sync-status {
  font-size: var(--text-xs);
  color: var(--ms-text-muted);
  white-space: nowrap;
}
.topbar-sync-status:empty { display: none; }

/* ═══════════════════════════════════════════════════════════
   PROFILE DROPDOWN — Azure style
   ═══════════════════════════════════════════════════════════ */
.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 210px;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-dropdown);
  padding: 4px 0;
  overflow: hidden;
  animation: dropdownFadeIn 0.12s ease;
}
.profile-dropdown.show { display: block; }

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-dropdown-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #E8E8E8;
}
.profile-dropdown-header-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-round);
  background: linear-gradient(135deg, var(--wd-green-1), var(--wd-green-3));
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: #fff; flex-shrink: 0;
}
.profile-dropdown-header-info {
  display: flex; flex-direction: column;
  min-width: 0;
}
.profile-dropdown-header-name {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: #1A1A1A;
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-dropdown-header-email {
  font-size: 11px; color: #707070;
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.profile-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  font-size: var(--text-sm); color: #1A1A1A;
  cursor: pointer; text-decoration: none;
  transition: background 0.1s ease;
  border: none; background: none;
  width: 100%; text-align: left;
  font-family: var(--font-family);
  line-height: 1.4;
}
.profile-dropdown-item:hover {
  background: #F3F3F3;
  text-decoration: none;
  color: #1A1A1A;
}
.profile-dropdown-item:active { background: #E8E8E8; }
.profile-dropdown-item svg {
  width: var(--icon-md); height: var(--icon-md); flex-shrink: 0;
  stroke: #707070; fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.profile-dropdown-item:hover svg { stroke: #1A1A1A; }

.profile-dropdown-divider {
  height: 1px; background: #E8E8E8; margin: 4px 0;
}
.profile-dropdown-item.signout { color: #CC3300; }
.profile-dropdown-item.signout:hover { background: #FDECEA; }
.profile-dropdown-item.signout svg { stroke: #CC3300; }
.profile-dropdown-item.signout:hover svg { stroke: #CC3300; }

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER — MS365 Admin Center style
   ═══════════════════════════════════════════════════════════ */
.page-header {
  background: #FFFFFF;
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-6);
  padding: 20px var(--space-6) 0;
  border-bottom: 1px solid #E0E0E0;
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #4A9E6E 0%, #2E7D5A 50%, transparent 100%);
}
.page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  padding-bottom: 16px;
}
.page-eyebrow {
  font-size: var(--text-xs);
  color: #707070;
  font-weight: var(--weight-normal);
  margin-bottom: 4px;
}
.page-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: #1A1A1A;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: var(--text-sm);
  color: #707070;
  line-height: 1.5;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── Page tabs ── */
.page-tabs {
  display: flex;
  margin: 0 calc(-1 * var(--space-6));
  padding: 0 var(--space-6);
  border-top: 1px solid #F0F0F0;
}
.page-tab {
  padding: 10px 16px;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: #707070;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap; text-decoration: none;
}
.page-tab:hover { color: #1A1A1A; text-decoration: none; }
.page-tab.active { color: #2E7D5A; border-bottom-color: #4A9E6E; font-weight: var(--weight-semibold); }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-family: var(--font-family);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-base);
}
.btn svg {
  width: var(--icon-md); height: var(--icon-md);
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-primary { background: var(--ms-brand); color: #fff; }
.btn-primary:hover { background: var(--ms-brand-dark); box-shadow: var(--shadow-xs); text-decoration: none; color: #fff; }

.btn-secondary { background: var(--ms-bg-main); color: var(--ms-text-primary); border-color: var(--ms-border-dark); }
.btn-secondary:hover { background: var(--ms-bg-alt); text-decoration: none; color: var(--ms-text-primary); }

.btn-ghost { background: transparent; color: var(--ms-text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--wd-green-tint); color: var(--ms-text-primary); text-decoration: none; }

.btn-danger { background: var(--ms-error); color: #fff; border-color: var(--ms-error-dark); }
.btn-danger:hover { background: var(--ms-error-dark); text-decoration: none; color: #fff; }

.btn-sm { padding: 6px 14px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 28px; font-size: var(--text-base); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; font-size: var(--text-xs);
  font-weight: var(--weight-semibold); border-radius: var(--radius-pill);
  line-height: 1.4; white-space: nowrap;
}
.badge-critical { background: var(--ms-error-light);   color: var(--ms-error); }
.badge-warning  { background: var(--ms-warning-light); color: var(--ms-warning); }
.badge-success  { background: var(--ms-success-light); color: var(--ms-success); }
.badge-info     { background: var(--ms-brand-tint);    color: var(--ms-brand-dark); }
.badge-neutral  { background: var(--ms-bg-alt);        color: var(--ms-text-muted); }

.risk-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
}
.risk-pill.critical { background: var(--ms-error-light); color: var(--ms-error); border: 1px solid #FAADA8; }
.risk-pill.warning  { background: var(--ms-warning-light); color: var(--ms-warning); border: 1px solid #F5D78E; }
.risk-pill.ok       { background: var(--ms-success-light); color: var(--ms-success); border: 1px solid var(--ms-border); }

/* ═══════════════════════════════════════════════════════════
   CARDS — unified elevation, radius, padding
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: #E8F5E8;
  border-bottom: 1px solid #A8D8B8;
}
.card-title {
  font-size: var(--text-sm); font-weight: var(--weight-semibold); color: #1A4A36;
}
.card-subtitle {
  font-size: var(--text-xs); color: var(--ms-text-secondary); margin-top: 2px;
}
.card-body { padding: var(--space-5); }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid #A8D8B8;
  background: #E8F5E8;
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--text-xs); color: #4A9E6E; font-style: italic;
}

/* Legacy fluent-card aliases */
.fluent-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: #E8F5E8;
  border-bottom: 1px solid #A8D8B8;
}
.fluent-card-body { padding: 0; overflow-x: auto; }

/* ═══════════════════════════════════════════════════════════
   KPI CARDS — unified radius, shadow, spacing
   ═══════════════════════════════════════════════════════════ */
.kpi-card {
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}
.kpi-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--ms-border-dark);
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 3px;
  background: var(--ms-border-dark);
}
.kpi-card.critical::before { background: var(--ms-error); }
.kpi-card.warning::before  { background: #F5A623; }
.kpi-card.success::before  { background: var(--ms-success); }
.kpi-card.info::before     { background: var(--ms-brand); }

.kpi-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ms-text-muted);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}
.kpi-value {
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
  color: var(--ms-text-primary);
  margin-bottom: var(--space-1);
  letter-spacing: -0.02em;
}
.kpi-value.critical { color: var(--ms-error); }
.kpi-meta {
  font-size: var(--text-xs);
  color: var(--ms-text-muted);
  margin-top: var(--space-1);
}

/* ═══════════════════════════════════════════════════════════
   TABLES — unified spacing, typography, hover
   ═══════════════════════════════════════════════════════════ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--ms-border-dark) var(--ms-bg-alt);
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: var(--ms-bg-alt); border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--ms-border-dark); border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--ms-brand); }

.fluent-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--text-sm); text-align: left;
}
.fluent-table thead tr {
  background: #E8F5E8;
  border-bottom: 2px solid #4A9E6E;
}
.fluent-table th {
  padding: 8px var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2E7D5A;
  white-space: nowrap;
}
.fluent-table td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--ms-border);
  color: var(--ms-text-primary);
  vertical-align: middle;
}
.fluent-table tbody tr { transition: var(--transition-fast); }
.fluent-table tbody tr:hover { background: #E8F5E8; }
.fluent-table tbody tr:last-child td { border-bottom: none; }
.fluent-table .cell-main { font-weight: var(--weight-medium); }
.fluent-table .cell-sub  { font-size: var(--text-xs); color: var(--ms-text-muted); margin-top: 2px; }
.fluent-table .cell-mono { font-family: 'Cascadia Code', 'Consolas', monospace; font-size: var(--text-xs); color: var(--ms-text-muted); }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--text-sm); text-align: left;
}
.data-table thead tr {
  background: #E8F5E8;
  border-bottom: 2px solid #4A9E6E;
}
.data-table th {
  padding: 8px var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2E7D5A;
  white-space: nowrap;
}
.data-table td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--ms-border);
  color: var(--ms-text-primary);
  vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition-fast); }
.data-table tbody tr:hover { background: #E8F5E8; }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .cell-main { font-weight: var(--weight-medium); }
.data-table .cell-sub  { font-size: var(--text-xs); color: var(--ms-text-muted); margin-top: 2px; }
.data-table .cell-mono { font-family: 'Cascadia Code', 'Consolas', monospace; font-size: var(--text-xs); color: var(--ms-text-muted); }

/* ═══════════════════════════════════════════════════════════
   FORMS & INPUTS — unified radius, focus ring
   ═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ms-text-primary);
  margin-bottom: var(--space-1);
}
.form-control {
  width: 100%; padding: 7px var(--space-3);
  font-size: var(--text-sm); font-family: var(--font-family);
  color: var(--ms-text-primary); background: #fff;
  border: 1px solid var(--ms-border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition-base); line-height: 1.4;
}
.form-control:focus { border-color: var(--ms-brand); box-shadow: 0 0 0 2px var(--ms-brand-light); }
.form-control::placeholder { color: var(--ms-text-muted); }
select.form-control { cursor: pointer; }

.input-group { display: flex; align-items: center; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }

.input-with-icon { position: relative; }
.input-with-icon svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: var(--icon-md); height: var(--icon-md);
  stroke: var(--ms-text-muted); fill: none; stroke-width: 1.5; pointer-events: none;
}
.input-with-icon .form-control { padding-left: 32px; }

.filter-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  border: 1px solid transparent;
}
.alert svg {
  width: var(--icon-md); height: var(--icon-md);
  fill: none; stroke: currentColor; stroke-width: 1.5; flex-shrink: 0; margin-top: 1px;
}
.alert-error   { background: var(--ms-error-light);   color: var(--ms-error);   border-color: #FAADA8; }
.alert-warning { background: var(--ms-warning-light); color: var(--ms-warning); border-color: #F5D78E; }
.alert-success { background: var(--ms-success-light); color: var(--ms-success); border-color: var(--ms-border); }
.alert-info    { background: var(--ms-brand-tint);    color: var(--ms-brand-dark); border-color: var(--ms-brand-light); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATES — professional, consistent
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px var(--space-6);
  text-align: center;
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-round);
  background: var(--ms-success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
}
.empty-state-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--ms-success);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-state-title {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--ms-text-primary);
  margin-bottom: var(--space-2);
}
.empty-state-desc {
  font-size: var(--text-base);
  color: var(--ms-text-muted);
  max-width: 400px;
  line-height: 1.5;
  margin-bottom: var(--space-5);
}
.empty-state-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Empty state for tables ── */
.table-empty-cell {
  padding: 48px var(--space-6) !important;
  text-align: center;
}
.table-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #848484;
}
.table-empty-state svg { color: #c8c8c8; stroke: currentColor; }

/* ═══════════════════════════════════════════════════════════
   SKELETON LOADERS — shimmer animation
   ═══════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #E8F5E8 25%, #D4ECD4 50%, #E8F5E8 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

/* ── Skeleton variants ── */
.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}
.skeleton-text-sm  { width: 60%; }
.skeleton-text-md  { width: 80%; }
.skeleton-text-lg  { width: 100%; }

.skeleton-heading {
  height: 24px;
  width: 40%;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-sm);
}

.skeleton-kpi {
  height: 100px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ms-border);
}

.skeleton-card {
  min-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ms-border);
}

.skeleton-table-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--ms-border);
}

/* ═══════════════════════════════════════════════════════════
   PERMISSION TREE
   ═══════════════════════════════════════════════════════════ */
.perm-tree { list-style: none; }
.perm-node {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: 6px var(--space-3); border-radius: var(--radius-sm);
  transition: var(--transition-base); cursor: pointer;
}
.perm-node:hover { background: #E8F5E8; }
.perm-node svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }
.perm-node-label { font-size: var(--text-sm); color: var(--ms-text-primary); }
.perm-node-meta  { font-size: var(--text-xs); color: var(--ms-text-muted); }
.perm-children { padding-left: var(--space-6); border-left: 1px solid var(--ms-border); margin-left: 19px; }

.perm-level {
  display: inline-flex; align-items: center; padding: 1px 7px;
  font-size: 10px; font-weight: var(--weight-semibold); border-radius: 3px; margin-left: var(--space-2);
}
.perm-level.full-control { background: #FDECEA; color: var(--ms-error); }
.perm-level.edit         { background: var(--ms-warning-light); color: var(--ms-warning); }
.perm-level.contribute   { background: var(--ms-brand-tint); color: var(--ms-brand-dark); }
.perm-level.read         { background: var(--ms-success-light); color: var(--ms-success); }

/* ═══════════════════════════════════════════════════════════
   DELTA DIFF ROWS
   ═══════════════════════════════════════════════════════════ */
.diff-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--ms-border);
  transition: var(--transition-base);
}
.diff-row:last-child { border-bottom: none; }
.diff-row:hover { background: #E8F5E8; }
.diff-badge {
  padding: 2px 8px; font-weight: var(--weight-semibold); font-size: var(--text-xs);
  border-radius: var(--radius-sm); flex-shrink: 0; min-width: 36px; text-align: center;
}
.diff-badge.added   { background: var(--ms-error-light); color: var(--ms-error); }
.diff-badge.removed { background: var(--ms-success-light); color: var(--ms-success); }
.diff-badge.changed { background: var(--ms-warning-light); color: var(--ms-warning); }
.diff-text { font-size: var(--text-sm); color: var(--ms-text-primary); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════
   LAST UPDATED / DATA SOURCE BAR
   ═══════════════════════════════════════════════════════════ */
.data-source-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--ms-text-muted);
  background: #F8FBF9;
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
}
.data-source-bar-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.data-source-bar-item .label { color: var(--ms-text-tertiary); }
.data-source-bar-item .value { color: var(--ms-text-primary); font-weight: var(--weight-medium); }
.data-source-bar-item .dot {
  width: 6px; height: 6px; border-radius: var(--radius-round); flex-shrink: 0;
}
.data-source-bar-item .dot.live { background: #2E7D5A; }

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--ms-border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--ms-brand);
  border-radius: 2px;
  transition: width var(--transition-slow);
}
.progress-bar-fill.indeterminate {
  animation: progress-indeterminate 1.5s ease-in-out infinite;
  width: 40%;
}
@keyframes progress-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ═══════════════════════════════════════════════════════════
   REFRESH BUTTON — animated
   ═══════════════════════════════════════════════════════════ */
.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-family);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ms-text-muted);
  cursor: pointer;
  transition: var(--transition-base);
}
.refresh-btn:hover { background: var(--wd-green-tint); color: var(--ms-text-primary); border-color: var(--ms-border-dark); }
.refresh-btn .refresh-icon {
  width: var(--icon-sm); height: var(--icon-sm);
  transition: transform 0.6s ease;
}
.refresh-btn.refreshing .refresh-icon {
  animation: spin 0.8s linear infinite;
}
.refresh-btn.refreshing {
  color: var(--ms-brand);
  border-color: var(--ms-brand-light);
  background: var(--ms-brand-tint);
  pointer-events: none;
}

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

/* ═══════════════════════════════════════════════════════════
   TOAST CONTAINER
   ═══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
#toast-container > div {
  pointer-events: auto;
  animation: toastSlideIn 0.25s ease;
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--ms-border); margin: var(--space-4) 0; }
.text-muted   { color: var(--ms-text-muted) !important; }
.text-error   { color: var(--ms-error) !important; }
.text-success { color: var(--ms-success) !important; }
.text-brand   { color: var(--ms-brand) !important; }
.text-mono    { font-family: 'Cascadia Code', 'Consolas', monospace; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — shared across app pages
   ═══════════════════════════════════════════════════════════ */
body { overflow-x: hidden; }

/* ── Hamburger button ── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: none;
  border: none;
  color: #1A1A1A;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Mobile nav dropdown ── */
.mobile-nav-dropdown {
  display: none;
  position: fixed;
  top: var(--topbar-height);
  left: 0; right: 0;
  background: #1E5C42;
  z-index: var(--z-dropdown);
  flex-direction: column;
  box-shadow: var(--shadow-md);
}
.mobile-nav-dropdown.open { display: flex; }
.mobile-nav-dropdown a {
  display: block;
  padding: 16px 24px;
  color: #fff;
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  font-weight: var(--weight-normal);
}
.mobile-nav-dropdown a:last-child {
  margin: 12px 24px 16px;
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: var(--weight-medium);
}

/* ── Sidebar toggle float (mobile) ── */
.sidebar-toggle-float { display: none; }

/* ── Scroll hint ── */
.scroll-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  font-style: italic;
  color: #848484;
  padding: 8px 0 0;
}

/* ── Sidebar backdrop ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: calc(var(--z-sidebar) - 5);
}
.sidebar-backdrop.show { display: block; }

/* ═══════════════════════════════════════════════════════════
   COMMAND BAR — Microsoft Defender / Purview style
   Flat, minimal, Segoe UI, 16px icons, no gradients
   ═══════════════════════════════════════════════════════════ */
.cmd-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--space-4);
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  min-height: 40px;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.cmd-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.cmd-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Command button — small, flat, 16px icon ── */
.cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease;
  height: 30px;
  line-height: 1;
}
.cmd-btn:hover {
  background: var(--sidebar-bg-hover);
  color: var(--ms-text-primary);
}
.cmd-btn:active {
  background: #E0E0E0;
}
.cmd-btn svg {
  width: var(--icon-md);
  height: var(--icon-md);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Primary variant ── */
.cmd-btn.cmd-primary {
  background: var(--ms-brand);
  color: #fff;
  border-color: var(--ms-brand);
}
.cmd-btn.cmd-primary:hover {
  background: var(--ms-brand-dark);
  border-color: var(--ms-brand-dark);
}

/* ── Refreshing state ── */
.cmd-btn.refreshing {
  color: var(--ms-brand);
  border-color: var(--ms-brand-light);
  background: var(--ms-brand-tint);
  pointer-events: none;
}
.cmd-btn.refreshing .cmd-icon-refresh {
  animation: spin 0.8s linear infinite;
}

/* ── Active/toggled state ── */
.cmd-btn.toggled {
  background: var(--ms-brand-tint);
  color: var(--ms-brand-dark);
  border-color: var(--ms-brand-light);
}

/* ── Command divider ── */
.cmd-divider {
  width: 1px;
  height: 18px;
  background: var(--ms-border);
  margin: 0 var(--space-1);
}

/* ── Command search input ── */
.cmd-search {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px var(--space-2);
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  height: 30px;
  min-width: 160px;
}
.cmd-search:focus-within {
  border-color: var(--ms-brand);
  box-shadow: 0 0 0 2px var(--ms-brand-light);
}
.cmd-search svg {
  width: var(--icon-md);
  height: var(--icon-md);
  stroke: var(--ms-text-muted);
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}
.cmd-search input {
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  outline: none;
  width: 100%;
}
.cmd-search input::placeholder {
  color: var(--ms-text-muted);
}

/* ── Auto-refresh label ── */
.cmd-refresh-label {
  font-size: var(--text-xs);
  color: var(--ms-text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.cmd-refresh-label .dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-round);
  background: var(--ms-success);
  flex-shrink: 0;
}
.cmd-refresh-label .dot.paused {
  background: var(--ms-text-muted);
}

/* ── Export dropdown ── */
.cmd-dropdown {
  position: relative;
}
.cmd-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-dropdown);
  padding: 4px 0;
  animation: dropdownFadeIn 0.12s ease;
}
.cmd-dropdown-menu.open {
  display: block;
}
.cmd-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px 12px;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background 0.08s ease;
}
.cmd-dropdown-item:hover {
  background: var(--sidebar-bg-hover);
}
.cmd-dropdown-item svg {
  width: var(--icon-md);
  height: var(--icon-md);
  stroke: var(--ms-text-muted);
  fill: none;
  stroke-width: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   FILTER CHIPS — below Command Bar
   ═══════════════════════════════════════════════════════════ */
.filter-chips-area {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  margin-bottom: var(--space-4);
}
.filter-chips-area.has-chips {
  display: flex;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  background: var(--ms-brand-tint);
  border: 1px solid var(--ms-brand-light);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  cursor: default;
  animation: chipIn 0.2s ease;
  line-height: 1.4;
}
.filter-chip svg.chip-icon {
  width: 12px;
  height: 12px;
  stroke: var(--ms-brand-dark);
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.filter-chip .chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-round);
  border: none;
  background: transparent;
  cursor: pointer;
  margin-left: 2px;
  color: var(--ms-brand-dark);
  font-size: 14px;
  line-height: 1;
  transition: background 0.1s ease;
}
.filter-chip .chip-remove:hover {
  background: var(--ms-brand-light);
}

.filter-chips-clear {
  font-size: var(--text-xs);
  color: var(--ms-brand);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-family);
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
  white-space: nowrap;
}
.filter-chips-clear:hover {
  background: var(--sidebar-bg-hover);
  text-decoration: underline;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════
   FILTER PANEL — Fluent side panel
   ═══════════════════════════════════════════════════════════ */
.filter-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: var(--z-modal);
  justify-content: flex-end;
}
.filter-panel-overlay.open {
  display: flex;
}

.filter-panel {
  width: 320px;
  max-width: 100vw;
  height: 100%;
  background: var(--ms-bg-main);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow: hidden;
}
.filter-panel-overlay.open .filter-panel {
  transform: translateX(0);
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ms-border);
  flex-shrink: 0;
}
.filter-panel-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--ms-text-primary);
}
.filter-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--ms-text-muted);
  font-size: 18px;
  transition: background 0.1s ease;
}
.filter-panel-close:hover {
  background: var(--sidebar-bg-hover);
  color: var(--ms-text-primary);
}

.filter-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.filter-panel-body .form-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ms-text-primary);
  margin-bottom: 4px;
}
.filter-panel-body .form-control {
  width: 100%;
}

.filter-panel-footer {
  display: flex;
  gap: var(--space-2);
  padding: 12px 16px;
  border-top: 1px solid var(--ms-border);
  flex-shrink: 0;
}

/* ── Columns popover ── */
.cmd-columns-popover {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--ms-bg-main);
  border: 1px solid var(--ms-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-dropdown);
  padding: 8px 0;
  animation: dropdownFadeIn 0.12s ease;
}
.cmd-columns-popover.open {
  display: block;
}
.cmd-column-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--ms-text-primary);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
.cmd-column-option:hover {
  background: var(--sidebar-bg-hover);
}
.cmd-column-check {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ms-brand);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   COMMAND BAR — responsive
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .cmd-bar {
    padding: 4px var(--space-2);
    gap: var(--space-1);
  }
  .cmd-btn .cmd-btn-label {
    display: none;
  }
  .cmd-btn {
    padding: 5px 8px;
  }
  .cmd-search {
    min-width: 120px;
  }
  .cmd-refresh-label {
    display: none;
  }
  .cmd-divider.hide-mobile {
    display: none;
  }
}

@media (max-width: 600px) {
  .cmd-bar-right {
    display: none;
  }
  .cmd-search {
    min-width: 100px;
    flex: 1;
  }
}
