/* QA Web — Asana-Inspired Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Asana dark mode palette */
  --bg:           #1a1a2e;
  --bg-raised:    #1e1e32;
  --surface:      #252540;
  --surface2:     #2a2a4a;
  --surface3:     #32325a;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --border-strong:rgba(255,255,255,0.18);

  /* Text hierarchy */
  --text:         #edeef0;
  --text-secondary:#9d9faa;
  --text-muted:   #6e7081;
  --text-faint:   #515264;

  /* Accent — Emerald brand */
  --accent:       #059669;
  --accent-hover: #34D399;
  --accent-bg:    rgba(5,150,105,0.12);
  --accent-border:rgba(5,150,105,0.3);

  /* Functional colors */
  --blue:         #4573d2;
  --blue-light:   #5a8af2;
  --blue-bg:      rgba(69,115,210,0.12);
  --blue-border:  rgba(69,115,210,0.3);

  --green:        #5da283;
  --green-bg:     rgba(93,162,131,0.12);
  --green-border: rgba(93,162,131,0.3);

  --red:          #e8384f;
  --red-bg:       rgba(232,56,79,0.12);
  --red-border:   rgba(232,56,79,0.3);

  --amber:        #ec8d31;
  --amber-bg:     rgba(236,141,49,0.12);
  --amber-border: rgba(236,141,49,0.3);

  --purple:       #7c5cfc;
  --purple-bg:    rgba(124,92,252,0.12);
  --purple-border:rgba(124,92,252,0.3);

  --cyan:         #37c5ab;
  --cyan-bg:      rgba(55,197,171,0.12);

  --teal:         #4ecdc4;

  /* Brand gradient (Emerald → Lime) */
  --brand-from:   #34D399;
  --brand-mid:    #059669;
  --brand-to:     #BEF264;
  --brand-bg:     rgba(5,150,105,0.10);
  --brand-border: rgba(5,150,105,0.30);
  --brand-glow:   rgba(5,150,105,0.15);

  /* Layout */
  --sidebar-width: 248px;
  --radius:       8px;
  --radius-sm:    6px;
  --radius-lg:    12px;
  --radius-xl:    16px;

  /* Shadows — very subtle in dark mode */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg:    0 8px 30px rgba(0,0,0,0.4);

  --transition:   0.15s ease;
}

/* ============================================
   LIGHT MODE — override :root variables
   ============================================ */
html.light-mode {
  --bg:           #f5f6f8;
  --bg-raised:    #ffffff;
  --surface:      #ffffff;
  --surface2:     #f0f1f3;
  --surface3:     #e4e6ea;
  --border:       rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);
  --border-strong:rgba(0,0,0,0.22);

  --text:         #1e1e2e;
  --text-secondary:#4a4a5a;
  --text-muted:   #7a7a8a;
  --text-faint:   #a0a0b0;
  --text-bright:  #111118;

  --accent-bg:    rgba(5,150,105,0.08);
  --accent-border:rgba(5,150,105,0.25);

  --blue-bg:      rgba(69,115,210,0.08);
  --blue-border:  rgba(69,115,210,0.2);
  --green-bg:     rgba(93,162,131,0.08);
  --green-border: rgba(93,162,131,0.2);
  --red-bg:       rgba(232,56,79,0.06);
  --red-border:   rgba(232,56,79,0.2);
  --amber-bg:     rgba(236,141,49,0.08);
  --amber-border: rgba(236,141,49,0.2);
  --purple-bg:    rgba(124,92,252,0.08);
  --purple-border:rgba(124,92,252,0.2);
  --cyan-bg:      rgba(55,197,171,0.08);

  --brand-bg:     rgba(5,150,105,0.06);
  --brand-border: rgba(5,150,105,0.20);
  --brand-glow:   rgba(5,150,105,0.12);

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 30px rgba(0,0,0,0.1);
}

/* Light mode — component overrides */
html.light-mode body { background: var(--bg); }
html.light-mode .sidebar { background: #fff; border-right: 1px solid var(--border-strong); }
html.light-mode .sidebar-brand { border-bottom-color: var(--border); }
html.light-mode .sidebar-link:hover { background: rgba(0,0,0,0.04); }
html.light-mode .sidebar-link.active { background: rgba(5,150,105,0.12); color: #047857; font-weight: 600; }
html.light-mode .sidebar-link.active .icon { opacity: 1; color: #059669; }
html.light-mode .sidebar-link { color: #4a5568; }
html.light-mode .sidebar-link:hover { color: #1a1a2e; }
html.light-mode .sidebar-section-label { color: #9ca3af; }
html.light-mode .sidebar-section-label:hover { background: rgba(0,0,0,0.03); }
html.light-mode .sidebar-user { border-top: 1px solid var(--border); }
html.light-mode .sidebar-user-avatar { color: #fff; }
html.light-mode .card { border: 1px solid var(--border-hover); box-shadow: var(--shadow-sm); }
html.light-mode .form-input, html.light-mode .form-select, html.light-mode .form-textarea {
  background: #fff; border-color: var(--border-hover); color: var(--text);
}
html.light-mode .btn { color: #fff; }
html.light-mode .btn-outline { color: var(--text-secondary); background: #fff; }
html.light-mode .btn-outline:hover { background: var(--surface2); }
html.light-mode ::selection { background: rgba(5,150,105,0.20); }
html.light-mode a { color: var(--brand-mid); }
html.light-mode .sidebar-company-select { background: var(--surface2); }
html.light-mode .company-pill { background: #fff; border-color: var(--border-hover); }

/* ============================================
   RESET & BASE
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-mid); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-from); text-decoration: none; }

::selection { background: rgba(245,158,11,0.30); }

/* ============================================
   LAYOUT — Sidebar + Main
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar — thin & unobtrusive */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-to));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text);
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-company-switcher {
  padding: 10px 12px;
}
.company-switcher-pills {
  display: flex;
  gap: 6px;
}
.company-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.company-pill:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.company-pill.active {
  font-weight: 600;
}
.company-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 20px 12px 6px;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-section-label:hover { background: rgba(255,255,255,0.03); border-radius: var(--radius-sm); }
.sidebar-section-chevron { font-size: 10px; color: var(--text-faint); transition: transform 0.2s; }
.sidebar-section-chevron.expanded { transform: rotate(90deg); }
.sidebar-section-links { }
.sidebar-section-links.collapsed { display: none; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--brand-bg);
  color: #fff;
  border-left: 3px solid var(--brand-mid);
  padding-left: 9px;
}
.sidebar-link .icon {
  width: 20px;
  text-align: center;
  opacity: 0.6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-link .icon svg {
  display: block;
}
.sidebar-link:hover .icon { opacity: 0.9; }
.sidebar-link.active .icon { opacity: 1; }

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}
.sidebar-user-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.sidebar-logout {
  font-size: 16px;
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 4px;
  line-height: 1;
}
.sidebar-logout:hover { color: var(--red); }

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 36px;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--brand-mid), var(--brand-to), transparent) 1;
  color: var(--text);
}
/* Page description sitting as a direct child of .page-header used to
   share the flex row with <h1>, putting the description horizontally
   beside the title (and squashing the title onto multiple lines when
   the description was wide). Templates that wrap title+description
   in a <div> already render correctly; this rule fixes the templates
   that emit them as siblings (ops_health, admin_audit_log,
   admin_roles, etc.) without requiring per-template HTML changes. */
.page-header > .page-description {
  flex-basis: 100%;
  order: 99;
  margin-top: 4px;
}
.page-header .page-description {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.breadcrumb {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-faint); font-size: 10px; }

/* ============================================
   CARDS — Asana clean panel style
   ============================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text);
}
.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Config cards — Asana project-card style */
.config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition);
  text-decoration: none;
}
.config-card:hover {
  border-color: var(--border-hover);
  background: var(--surface2);
  text-decoration: none;
}
.config-card .dept {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cyan);
  background: var(--cyan-bg);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}
.config-card .name {
  font-weight: 500;
  font-size: 14px;
  margin-top: 4px;
  color: var(--text);
}
.config-card .file {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.config-card .arrow {
  color: var(--text-faint);
  font-size: 16px;
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition);
}
.config-card:hover .arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--text-muted);
}

/* ============================================
   BUTTONS — Asana flat style
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-to));
  color: #1a1a2e;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); color: #1a1a2e; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-to));
  color: #1a1a2e;
}
.btn-primary:hover { filter: brightness(1.1); color: #1a1a2e; }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); color: #fff; }

.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-success:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: rgba(232,56,79,0.2); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
}
.btn-outline:hover {
  border-color: var(--brand-border);
  color: var(--text);
  background: var(--brand-bg);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 4px 8px;
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ============================================
   FORMS — Asana minimal inputs
   ============================================ */

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hover);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-faint);
}
.form-textarea { min-height: 64px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
}
.alert-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}

/* ============================================
   BADGES — Asana pill style
   ============================================ */

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ============================================
   LIST ROWS — Asana task-row style
   ============================================ */

.job-row,
.agent-row,
.team-row,
.user-row {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
/* Legacy flex layout for roster/team rows (not table-based user management) */
.user-row-flex {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.job-row:hover,
.agent-row:hover,
.team-row:hover,
.user-row:hover {
  background: rgba(255,255,255,0.03);
}

/* Remove individual row backgrounds and borders — use bottom border only */
.job-row {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;               /* lets the .job-detail panel (width:100%) drop below */
}
.job-row > div {
  min-width: 0;                  /* allow flex children to shrink instead of overflowing */
}
.job-row > div:not(.job-detail) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-row .form-input,
.agent-row .form-select,
.team-row .form-input,
.team-row .form-select {
  background: var(--surface);
}

.hidden { display: none !important; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.progress-pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ============================================
   TABLE HEADERS — Asana column headers
   ============================================ */

.table-header {
  display: flex;
  gap: 10px;
  padding: 0 14px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

/* ============================================
   SCORECARD EDITOR
   ============================================ */

.category-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}
.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.category-header .cat-num {
  font-size: 10px;
  font-weight: 600;
  color: var(--blue-light);
  background: var(--blue-bg);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.criterion-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 6px;
  transition: border-color var(--transition);
}
.criterion-row:hover { border-color: var(--border-hover); }
.criterion-row .crit-num {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ============================================
   TAGS EDITOR
   ============================================ */

.tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.tag-row:hover { background: rgba(255,255,255,0.03); }
.tag-preview {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.tag-row input { background: var(--surface); }
.tag-row .color-input {
  width: 32px; height: 24px;
  padding: 0; border: none;
  cursor: pointer;
  border-radius: 4px;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */

.dashboard-links { display: flex; gap: 8px; flex-wrap: wrap; }
.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.dashboard-link:hover {
  border-color: var(--blue-border);
  color: var(--blue-light);
  text-decoration: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.dash-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
}
.dash-tile:hover {
  border-color: var(--border-hover);
  background: var(--surface2);
  text-decoration: none;
}
.dash-icon { font-size: 22px; width: 36px; text-align: center; }
.dash-info { flex: 1; min-width: 0; }
.dash-name { font-weight: 500; font-size: 13px; color: var(--text); }
.dash-meta { display: flex; gap: 6px; margin-top: 4px; }

/* ============================================
   GOAL TABS — Asana tab style
   ============================================ */

.goal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.goal-tab {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.goal-tab:hover { color: var(--text); }
.goal-tab.active { color: var(--text); border-bottom-color: var(--brand-mid); }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color var(--transition);
}
.goal-card:hover { border-color: var(--border-hover); }
.goal-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.goal-input-wrap { display: flex; align-items: center; gap: 4px; }
.goal-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.goal-input:focus { border-color: var(--blue); }
.goal-input::placeholder { color: var(--text-faint); font-weight: 400; font-size: 13px; }
.goal-value { font-size: 20px; font-weight: 600; color: var(--text); }
.goal-unit { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.goal-note { font-size: 10px; color: var(--amber); margin-top: 4px; font-style: italic; }

/* ============================================
   SECTION UTILITIES
   ============================================ */

.section-actions { display: flex; gap: 8px; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 14px;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Stat cards for dashboards */
.stat-card {
  text-align: center;
  padding: 18px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

/* ============================================
   STATUS GRID (Call Puller, etc.)
   ============================================ */

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.status-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: center;
}
.status-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--blue);
}
.status-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============================================
   DATA TABLE
   ============================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* KB category rows */
.kb-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: border-color var(--transition);
}
.kb-cat-row:hover {
  border-color: var(--blue-border);
  text-decoration: none;
}

/* Form grid layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* Checkbox styling */
input[type="checkbox"] {
  accent-color: var(--brand-mid);
  width: 15px;
  height: 15px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-nav { flex-direction: row; padding: 6px; gap: 0; }
  .sidebar-section-label { display: none; }
  .sidebar-brand { display: none; }
  .main-content { margin-left: 0; }
  .container { padding: 20px 16px; }
  .form-row { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .config-layout { flex-direction: column; }
  .config-sidenav { width: 100% !important; position: static !important; }
}

/* ── Config section side-nav ─────────────────────────────────── */
.config-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.config-sidenav {
  width: 190px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}
.config-sidenav .card {
  padding: 0;
  overflow: hidden;
}
.config-sidenav-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.config-sidenav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.config-sidenav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.config-nav-items {
  padding: 4px 0;
}
.config-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.config-nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-decoration: none;
}
.config-nav-item.active {
  background: var(--blue-bg);
  color: var(--blue-light);
}
.config-nav-item svg { flex-shrink: 0; opacity: 0.7; }
.config-nav-item:hover svg,
.config-nav-item.active svg { opacity: 1; }
.config-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.config-main { flex: 1; min-width: 0; }

/* ── Rich media content (KB articles, Academy modules, Flow nodes) ── */
.module-html-content img,
.fr-content img,
.fr-kb-panel img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 10px 0;
  display: block;
}
.module-html-content iframe,
.fr-content iframe {
  max-width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  display: block;
  margin: 12px 0;
}
.module-html-content h1, .module-html-content h2, .module-html-content h3,
.module-html-content h4 { color: var(--text); margin-top: 20px; margin-bottom: 8px; }
.module-html-content p { margin-bottom: 12px; }
.module-html-content ul, .module-html-content ol { padding-left: 22px; margin-bottom: 12px; }
.module-html-content li { margin-bottom: 5px; }
.module-html-content strong, .module-html-content b { color: var(--text); }
.module-html-content a { color: var(--accent); }
.module-html-content code { background: var(--surface2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.module-html-content pre { background: var(--surface2); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; margin-bottom: 12px; }
.module-html-content blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 12px 0; color: var(--text-secondary); font-style: italic; }

/* ── Data Guide cross-link badges ──
   Inline "ⓘ" icon next to KPI labels + chart titles. Click → entry page.
   See templates/_data_guide_link.html for the macro that renders these. */
.dg-info-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--text-muted);
  opacity: 0.45;
  vertical-align: middle;
  text-decoration: none;
  line-height: 1;
  transition: opacity 0.12s, color 0.12s, transform 0.12s;
}
.dg-info-badge:hover,
.dg-info-badge:focus-visible {
  opacity: 1;
  color: var(--brand-from);
  transform: scale(1.08);
  outline: none;
}
.dg-info-badge svg { display: block; }
html.light-mode .dg-info-badge { color: var(--text-secondary); opacity: 0.5; }
html.light-mode .dg-info-badge:hover,
html.light-mode .dg-info-badge:focus-visible { color: var(--brand-mid); opacity: 1; }

/* ── Section-level tab bar (Platform Admin groups) ──
   Shared between Jobs/Schedules, Data Catalog (Guide + Flow), and
   QA Pipeline (Pipeline + Call Puller). See templates/_admin_tab_bar.html.

   Visual goal: read unambiguously as clickable navigation, not as a
   section subtitle. Pill-style with a clear container around it
   (background + border), generous padding, hover lift, brand-color
   active fill. Sits flush above the page header so the H1 below
   makes it obvious which tab is "this page". */
.admin-tab-bar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}
.admin-tab {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  border-radius: 7px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}
.admin-tab:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.04);
}
.admin-tab.is-active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  font-weight: 600;
}
.admin-tab.is-active:hover {
  /* override the generic hover background so the active gradient stays */
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  filter: brightness(1.05);
}
html.light-mode .admin-tab-bar {
  background: rgba(0, 0, 0, 0.02);
}
html.light-mode .admin-tab { color: var(--text-secondary); }
html.light-mode .admin-tab:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}
html.light-mode .admin-tab.is-active {
  color: #fff;
}
