body {
  font-family: var(--font-body), 'Segoe UI', sans-serif;
  background-color: var(--surface);
  padding: 0;
  margin: 0;
  height: 100vh;
  display: flex;
  overflow: hidden;
}
/* --sidebar-width is scoped to .layout so it does not override the global
   256px token (style.css) for sidebars on other pages. */
.layout {
  --sidebar-width: 320px;
  display: flex;
  width: 100%;
  margin-top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  position: relative;
}
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-container-lowest);
  border-right: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  transition: transform 0.3s ease;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
  flex-shrink: 0;
}
.sidebar.closed {
  transform: translateX(-100%);
}

/* Sidebar collapse-toggle (visible inside the sidebar when expanded). */
.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 11;
  transition:
    background 0.15s,
    color 0.15s;
}
.sidebar-toggle:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* Floating expand-toggle (visible only when sidebar is collapsed). */
.sidebar-expand {
  position: fixed;
  top: 76px;
  left: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 90;
  box-shadow: var(--shadow-md);
  transition:
    background 0.15s,
    color 0.15s;
}
.sidebar-expand:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* Single collapse/expand toggle — lives in .layout (outside .sidebar) so it never
   slides away; flips glyph and slides to the panel edge on collapse. Supersedes the
   old .sidebar-toggle (inside panel) + .sidebar-expand (floating) pair. */
.sidebar-toggle-btn {
  position: absolute;
  top: 12px;
  left: calc(var(--sidebar-width) - 40px); /* panel top-right when open */
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  cursor: pointer;
  z-index: 20;
  box-shadow: var(--shadow-md);
  transition:
    left 0.3s ease,
    background 0.15s,
    color 0.15s;
}
.sidebar-toggle-btn:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}
.sidebar-toggle-btn .material-symbols-outlined {
  font-size: 18px;
}
/* Collapsed: slide the toggle to the panel's left edge. */
.layout.sidebar-collapsed .sidebar-toggle-btn {
  left: 12px;
}
.main-content {
  flex-grow: 1;
  padding: 20px 30px;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
  overflow-y: auto;
  background: var(--surface);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.main-content.expanded {
  margin-left: 0;
}

/* Accordion Styles */
.accordion-item {
  border-bottom: 1px solid var(--surface-container-high);
}
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 700;
  transition: color 0.2s;
}
.accordion-header:hover {
  color: var(--primary);
}
.accordion-header.active {
  color: var(--primary);
}
.accordion-header .material-symbols-outlined {
  transition: transform 0.3s;
  font-size: 18px;
  color: var(--outline);
}
/* First accordion clears the absolute collapse toggle (top-right) so the collapse
   chevron and the section's expand/collapse chevron don't overlap. */
.sidebar .accordion-item:first-of-type {
  margin-top: 24px;
}
.accordion-body {
  display: none;
  padding-bottom: 15px;
}
.accordion-body.active {
  display: block;
}
.tree-container {
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  height: 350px;
  overflow-y: auto;
  padding: 10px;
  background: var(--surface-container-low);
}
.node {
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 5px;
}
.node:hover {
  color: var(--primary);
}
.node.active {
  font-weight: 700;
  color: var(--primary);
  background: var(--surface-container);
  padding-left: 5px;
  border-radius: 4px;
}
.control-group {
  margin-bottom: 15px;
}
.sidebar select,
.sidebar input[type='date'] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
}
.check-item {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface);
}
.btn-apply {
  background: var(--primary);
  color: var(--on-primary);
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
}
.report-card {
  background: var(--surface-container-lowest);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-bottom: 20px;
}
.report-toolbar {
  padding: 20px;
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.report-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
}
.report-meta {
  font-size: 13px;
  color: var(--on-surface-variant);
}
.action-btns button {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-lowest);
  border-radius: 6px;
  cursor: pointer;
  margin-left: 8px;
}
.table-container {
  flex-grow: 1;
  overflow-y: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
th {
  text-align: left;
  padding: 12px 20px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 5;
}
td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--surface-container-high);
  color: var(--on-surface);
  overflow-wrap: break-word;
}
tr:hover {
  background: var(--surface-container-low);
}

/* Column widths — Approver gets the most room (3-line name/email/OU stack);
   Role takes the next chunk; the three numeric columns are narrow and equal. */
#reportTable th:nth-child(1),
#reportTable td:nth-child(1) {
  width: 36%;
}
#reportTable th:nth-child(2),
#reportTable td:nth-child(2) {
  width: 22%;
}
#reportTable th:nth-child(3),
#reportTable td:nth-child(3),
#reportTable th:nth-child(4),
#reportTable td:nth-child(4),
#reportTable th:nth-child(5),
#reportTable td:nth-child(5) {
  width: 14%;
}

/* Numeric columns — center both header and cell so they share an axis. */
.th-safe,
.th-breach,
.th-total,
.rc-safe,
.rc-breach,
.rc-total {
  text-align: center;
}

.val-safe {
  color: var(--success);
  font-weight: 600;
}
.val-breach {
  color: var(--error);
  font-weight: 700;
}
.global-tooltip {
  display: none;
  position: fixed;
  z-index: 99999;
  width: 260px;
  background-color: var(--inverse-surface);
  color: var(--on-primary);
  border-radius: 12px;
  padding: 16px;
  font-size: 12px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.35),
    0 12px 24px -10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
