:root {
  /* Type */
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace;
  /* Geometry */
  --radius: 12px;
  --radius-sm: 8px;
  /* Brand constants (theme-independent) — exact Illumio logo orange */
  --accent: #FF5500;
  --accent-hover: #E64D00;
  --accent-ink: #15202B;   /* text/icon that sits on an orange fill */
}

html[data-theme="dark"] {
  --bg: #11181F;
  --surface: #18222C;
  --surface-elevated: #1F2B37;
  --border: #2A3947;
  --border-strong: #36495A;
  --text: #EAF0F6;
  --text-muted: #93A4B5;
  --text-faint: #6A7C8E;
  --accent-text: #FF7A33;          /* legible orange on dark */
  --accent-tint: rgba(255, 85, 0, 0.12);
  --accent-tint-strong: rgba(255, 85, 0, 0.18);
  --success: #34D399;
  --warning: #FBBF24;
  --error: #F87171;
  --info: #6FB1E0;                 /* steel-blue: informational, not brand */
  --code-bg: #0C1218;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --surface-elevated: #F3F6F9;
  --border: #DCE3EA;
  --border-strong: #C3CED8;
  --text: #16212B;
  --text-muted: #54636F;
  --text-faint: #8090A0;
  --accent-text: #C2410C;          /* deepened orange, legible on light */
  --accent-tint: rgba(255, 85, 0, 0.09);
  --accent-tint-strong: rgba(255, 85, 0, 0.15);
  --success: #0F9D6E;
  --warning: #B45309;
  --error: #DC2626;
  --info: #2563A0;
  --code-bg: #0F1620;              /* console blocks stay dark in light mode */
  --shadow: 0 12px 32px rgba(22, 33, 43, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

button, a, input, select, textarea, label {
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
a.brand:hover { opacity: 0.85; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.illumio-logo {
  display: block;
}

.illumio-logo-brand {
  width: 1.75rem;
  height: 1.75rem;
}

.illumio-logo-auth {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
}

.brand-name {
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

.content:has(.admin-page) {
  max-width: none;
  width: 100%;
  padding: 2rem 2.5rem;
}

.content:has(.care-about-app) {
  max-width: none;
  width: 100%;
  padding: 2rem 2.5rem;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success);
}

.flash-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--error);
}

.flash-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--warning);
}

.flash-info {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--info);
}

/* Top-of-page red nudge for users still on username/password login. */
.okta-warning {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: var(--error);
  font-size: 0.9rem;
  line-height: 1.4;
}
.okta-warning svg { flex: 0 0 auto; }
.okta-warning a {
  color: var(--error);
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.auth-card {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.2);
}

.email-input-group {
  display: flex;
  align-items: stretch;
}

.email-input-group input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.email-domain-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.auth-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-notice {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.auth-notice-warning {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--warning);
}

.auth-notice-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--warning);
}

.auth-notice-body {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--warning);
}

.auth-notice-body + .auth-notice-body {
  margin-top: 0.5rem;
}

.auth-notice-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-notice-link:hover {
  color: var(--text);
}

.auth-sso-hint {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-footer-sep {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

.auth-card-wide {
  max-width: 440px;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tab-active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(255, 85, 0, 0.12);
}

.auth-form-hidden {
  display: none;
}

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-checkbox input {
  width: auto;
  margin-top: 0.15rem;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.admin-col-email {
  font-weight: 600;
}

.admin-col-time {
  white-space: nowrap;
}

.admin-time-relative {
  display: block;
  font-weight: 500;
}

.admin-time-pdt {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.admin-col-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-inline-form {
  display: inline;
}

.admin-muted {
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.status-pill-pending {
  background: rgba(250, 204, 21, 0.15);
  color: var(--warning);
}

.status-pill-inactive {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.status-pill-warning {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.admin-key-reveal {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.admin-key-value {
  display: block;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface-elevated);
  word-break: break-all;
}

.menu-card-admin {
  border-color: rgba(168, 85, 247, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(255, 85, 0, 0.12);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-elevated);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--error);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--error);
  color: var(--error);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.menu-card {
  display: block;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.menu-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.menu-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.menu-card p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.menu-card-link {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
}

.result-card {
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-greeting {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.result-meta {
  margin: 0;
  color: var(--text-muted);
}

.connection-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.connection-pill-online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.connection-pill-offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.menu-card-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.staff-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.staff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
}

.staff-status {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.staff-status-ok {
  color: var(--success);
}

.staff-status-running {
  color: var(--warning);
}

.staff-status-error {
  color: var(--error);
}

.staff-output {
  margin: 0;
  min-height: 280px;
  max-height: 60vh;
  overflow: auto;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--code-bg);
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.menu-card-featured {
  border-color: rgba(255, 85, 0, 0.45);
  background: linear-gradient(180deg, rgba(255, 85, 0, 0.08), var(--surface));
}

.jira-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}

.jira-sidebar,
.jira-main {
  display: grid;
  gap: 1rem;
}

.jira-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.jira-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.jira-status {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.jira-status-ok { color: var(--success); }
.jira-status-running { color: var(--warning); }
.jira-status-error { color: var(--error); }

.jira-project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-height: 320px;
  overflow: auto;
}

.jira-project-btn,
.jira-issue-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.jira-project-btn {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem;
}

.jira-project-btn:hover,
.jira-issue-card:hover {
  border-color: var(--accent);
  background: var(--surface-elevated);
}

.jira-project-btn span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.jira-search-form {
  display: grid;
  gap: 0.75rem;
}

.jira-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.jira-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.jira-issue-list {
  display: grid;
  gap: 0.75rem;
}

.jira-issue-card {
  padding: 0.9rem 1rem;
}

.jira-issue-key {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.jira-issue-summary {
  margin-bottom: 0.5rem;
}

.jira-issue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.jira-empty {
  color: var(--text-muted);
  margin: 0;
}

.jira-detail-summary {
  margin: 0 0 1rem;
}

.jira-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.jira-detail-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.jira-description pre,
.jira-comment-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.jira-description,
.jira-comments {
  margin-top: 1rem;
}

.jira-comment {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.jira-comment-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

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

/* ── Hamburger toggle (hidden on desktop) ────────────────────────────── */

.topbar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.4rem;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
}
.topbar-toggle svg { display: block; }
.topbar-toggle:hover { background: var(--surface-elevated); }

/* ── Mobile: 768px and below ─────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Topbar → hamburger menu */
  .topbar-toggle { display: block; }

  .topbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .topbar-actions {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
  }
  .topbar-actions.topbar-actions--open {
    display: flex;
  }
  .topbar-actions .btn { justify-content: flex-start; }
  .topbar-actions .user-pill {
    text-align: center;
    font-size: 0.8rem;
    order: -1;
  }
  .topbar-actions .connection-pill { text-align: center; order: -2; }

  /* Content padding */
  .content { padding: 1.25rem 1rem; }
  .content:has(.admin-page),
  .content:has(.care-about-app) { padding: 1.25rem 1rem; }

  /* Page headers */
  .page-header h1 { font-size: 1.5rem; }

  /* Auth cards */
  .auth-card {
    margin: 1.5rem auto;
    padding: 1.5rem;
    max-width: 100%;
  }
  .auth-header h1 { font-size: 1.4rem; }

  /* Dashboard cards */
  .menu-grid {
    grid-template-columns: 1fr;
  }

  /* Company Cases: revert to scrollable on mobile */
  .app-shell:has(.cc-app) { height: auto; overflow: visible; }
  .content:has(.cc-app)   { overflow: visible; flex: none; min-height: auto; }
  .cc-app                 { overflow: visible; min-height: auto; }
  #cc-output              { overflow: visible; max-height: 60vh; }

.app-shell:has(.scanner-app) {
    height: auto;
    overflow: visible;
  }
  .content:has(.scanner-app) {
    padding: 1rem;
    overflow: visible;
    min-height: auto;
    flex: none;
  }
  .scanner-app {
    min-height: auto;
  }
  .scanner-output {
    min-height: 200px;
    max-height: 60vh;
  }
  .scanner-toolbar {
    flex-wrap: wrap;
  }
  .scanner-toolbar-actions {
    width: 100%;
  }
  .scanner-toolbar-actions .btn {
    flex: 1;
  }

  /* JIRA references table: on mobile only, revert to auto layout + horizontal
     scroll (a fluid fixed layout would crush 10 columns into a phone width). */
  .jira-references-table {
    table-layout: auto;
    min-width: 900px;
  }
  .jira-references-table th { white-space: nowrap; }
  .jira-references-table-wrap {
    -webkit-overflow-scrolling: touch;
  }
  /* colgroup widths are desktop proportions — ignore them on mobile */
  .jira-references-table col { width: auto !important; }
  .care-table col { width: auto !important; }
  .jira-references-header {
    padding: 0.75rem 1rem 0.5rem;
  }
  .jira-references-footer {
    padding: 0.75rem 1rem;
  }

  /* Scanner tables */
  .scanner-table { min-width: 600px; }
  .scanner-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Admin table */
  .admin-table { min-width: 700px; }
  .admin-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Care About */
  .care-toolbar { flex-direction: column; align-items: stretch; }
  .care-toolbar-left { order: 1; }
  .care-toolbar-right { order: 0; flex-direction: column; align-items: stretch; }
  .care-add-form { flex-wrap: wrap; }
  .care-add-input { flex: 1; min-width: 0; }
  .care-add-form .btn { width: 100%; }
  .care-table { min-width: 900px; }
  .care-table-wrap { -webkit-overflow-scrolling: touch; }
  .care-tags-bar { padding: 0.5rem; }

  /* Monitor */
  .monitor-toolbar { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .monitor-toolbar-right { justify-content: space-between; }
  .monitor-stats { gap: 0.75rem; }
  .monitor-stat { min-width: 0; flex: 1; padding: 0.5rem 0.75rem; }
  .monitor-stream {
    max-height: calc(100vh - 300px);
    font-size: 0.7rem;
  }
  .ev { gap: 0.35rem; }
  .ev-ts { min-width: 60px; font-size: 0.65rem; }
  .ev-dir { min-width: 65px; font-size: 0.62rem; }
  .ev-type { min-width: 100px; font-size: 0.72rem; }

  /* Create Tenant */
  .ct-form { max-width: 100%; }
  .ct-field-row { flex-direction: column; gap: 0; }
  .ct-preview-card { max-width: 100%; }
  .ct-preview-field { flex-direction: column; gap: 0.25rem; }
  .ct-preview-label { min-width: 0; }

  /* Credentials */
  .creds-form { max-width: 100%; }
  .creds-pat-row { flex-wrap: wrap; }
  .creds-pat-row input { width: 100%; flex: none; }
  .creds-pat-row .btn { flex: 1; }
  .creds-actions { flex-wrap: wrap; }
  .creds-meta { word-break: break-word; }

  /* Staff panel */
  .staff-toolbar { flex-wrap: wrap; }
  .staff-output { font-size: 0.8rem; min-height: 200px; }

  /* Scanner offline banner code blocks */
  .scanner-offline-banner code {
    display: block;
    word-break: break-all;
    margin-top: 0.25rem;
    font-size: 0.75rem;
  }
}


/* ── Company Cases app — full-viewport layout (mirrors scanner-app) ────────── */

.app-shell:has(.cc-app) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.content:has(.cc-app) {
  max-width: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.content:has(.cc-app) .page-header {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}
.content:has(.cc-app) .page-header h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.content:has(.cc-app) .page-header p  { margin: 0.15rem 0; font-size: 0.9rem; }
.cc-app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: hidden;
}
.cc-search-phase {
  flex-shrink: 0;
}
.scanner-results:has(#cc-output) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#cc-output {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
/* ── Small phones: 480px and below ───────────────────────────────────── */

@media (max-width: 480px) {
  .content { padding: 1rem 0.75rem; }
  .content:has(.admin-page),
  .content:has(.care-about-app) { padding: 1rem 0.75rem; }

  .page-header h1 { font-size: 1.25rem; }
  .page-header p { font-size: 0.85rem; }

  .auth-card { padding: 1.25rem; margin: 1rem 0.5rem; }
  .auth-header h1 { font-size: 1.2rem; }
  .auth-notice { padding: 0.75rem; }
  .auth-notice-title { font-size: 0.85rem; }
  .auth-notice-body { font-size: 0.8rem; }

  .btn { padding: 0.6rem 0.9rem; font-size: 0.88rem; }
  .btn-sm { padding: 0.4rem 0.65rem; font-size: 0.78rem; }

  .flash { padding: 0.75rem; font-size: 0.85rem; }

  .scanner-section, .scanner-results { padding: 1rem; }
  .scanner-textarea { min-height: 90px; padding: 0.75rem; }
  .scanner-upload { padding: 0.85rem 1rem; }

  .monitor-stream { font-size: 0.65rem; line-height: 1.5; }
}

.scanner-mode-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--info);
}

.app-shell:has(.scanner-app) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.content:has(.scanner-app) {
  max-width: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content:has(.scanner-app) .page-header {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.content:has(.scanner-app--results) .page-header {
  margin-bottom: 0.5rem;
}

.content:has(.scanner-app) .page-header h1 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.content:has(.scanner-app) .page-header p {
  margin: 0.15rem 0;
  font-size: 0.9rem;
}

.scanner-app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.85rem;
}

.scanner-app--results {
  grid-template-rows: 1fr;
  gap: 0;
}

.scanner-input {
  display: contents;
}

.scanner-app--results .scanner-input {
  display: none;
}

.scanner-app--results .scanner-results {
  min-height: 100%;
}

.scanner-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.scanner-section,
.scanner-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.scanner-results {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scanner-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scanner-textarea {
  width: 100%;
  min-height: 110px;
  max-height: 160px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.scanner-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.2);
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.scanner-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scanner-upload {
  padding: 1.1rem 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  text-align: center;
}

.scanner-upload-active {
  border-color: var(--accent);
  background: rgba(255, 85, 0, 0.08);
}

.scanner-upload-icon {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.scanner-upload-text {
  margin: 0 0 0.35rem;
}

.scanner-browse {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.scanner-upload-types {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scanner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.scanner-status {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.scanner-status-ok { color: var(--success); }
.scanner-status-running { color: var(--warning); }
.scanner-status-error { color: var(--error); }

.scanner-output {
  flex: 1 1 auto;
  min-height: 280px;
  overflow: auto;
}

.scanner-app--results .scanner-output {
  min-height: 0;
}

.scanner-app--results .jira-references {
  min-height: 100%;
}

.scanner-output .scanner-block {
  min-height: 0;
}

.scanner-output .scanner-block + .scanner-block {
  margin-top: 0.75rem;
}

.scanner-block pre {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.scanner-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scanner-error {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.scanner-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.scanner-table-title {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.scanner-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.scanner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.scanner-table th,
.scanner-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.scanner-table th {
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scanner-table tbody tr:hover {
  background: rgba(255, 85, 0, 0.06);
}

.scanner-table tbody tr:last-child td {
  border-bottom: none;
}

.scanner-col-key {
  white-space: nowrap;
  width: 8rem;
}

.scanner-col-updated {
  white-space: nowrap;
  color: var(--text-muted);
}

.scanner-key-link {
  color: var(--success);
  font-weight: 600;
  text-decoration: none;
}

.scanner-key-link:hover {
  text-decoration: underline;
}

.scanner-status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.scanner-status-badge-done {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.scanner-status-badge-active {
  background: rgba(255, 85, 0, 0.15);
  color: var(--accent-text);
}

.scanner-status-badge-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.scanner-status-badge-default {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.jira-references {
  padding: 0 !important;
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.jira-references-header {
  padding: 1rem 1.25rem 0.75rem;
  flex-shrink: 0;
}

.jira-references-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.jira-references-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.jira-tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 85, 0, 0.18);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 600;
}

.jira-references-table-wrap {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.jira-references-table {
  width: 100%;
  /* Fluid: fixed layout fits the table to the available width and wraps cell
     text instead of forcing a min-width that overflows the screen. Per-column
     proportions come from each table's <colgroup>. Mobile switches this to a
     scrollable auto layout (see the max-width: 768px block). */
  table-layout: fixed;
  border-collapse: collapse;
  /* Tightened to match the Care About table (was 0.86rem). */
  font-size: 0.82rem;
}

.jira-references-table th,
.jira-references-table td {
  /* Tightened to match the Care About table (was 0.85rem 0.9rem) so all list
     views share the same compact line size. */
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.jira-references-table th {
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: normal;
}

.jira-references-table tbody tr:hover {
  background: rgba(255, 85, 0, 0.05);
}

.jira-references-table tbody tr:last-child td {
  border-bottom: none;
}

.jira-col-ticket {
  /* width comes from the table colgroup; keep the key from breaking mid-token */
}
.jira-col-ticket .key-chip,
.jira-col-ticket .jira-ticket-link,
.cases-case-link {
  white-space: nowrap;
}

.jira-col-updated {
  color: var(--text-muted);
}

.jira-col-comment {
  line-height: 1.45;
  color: var(--text-muted);
}

.jira-ticket-link {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

.jira-ticket-link:hover {
  text-decoration: underline;
}

.jira-status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  /* wrap only between whole words — the parent td forces break-word for long
     summaries, which would otherwise split "Review" into "Revie w". */
  word-break: normal;
  overflow-wrap: normal;
}

.jira-status-badge-new {
  background: rgba(234, 179, 8, 0.12);
  color: var(--warning);
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.jira-status-badge-done {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.jira-status-badge-active {
  background: rgba(255, 85, 0, 0.15);
  color: var(--accent-text);
}

.jira-status-badge-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.jira-status-badge-default {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.jira-priority {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.jira-priority-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--text-faint);
  flex-shrink: 0;
}

.jira-ai-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.jira-ai-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.jira-ai-summary {
  line-height: 1.45;
  color: var(--text);
}

/* Clamp long AI summaries to ~5 lines; clicking opens the full text in a
   modal (openListSummaryPopup, static/js/list-view.js) — mirrors Care About. */
.jira-ai-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.jira-ai-clamp:hover {
  color: var(--accent-text);
}

/* Shared AI-summary popup (list-view.js) — the "gold standard" modal from
   the Care About page, reused across all list views. */
.lv-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lv-modal {
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.lv-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.lv-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.lv-modal-meta strong {
  color: var(--accent-text);
}
.lv-modal-tag {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.lv-modal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lv-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 4px;
}
.lv-modal-close:hover {
  color: var(--text);
}
.lv-modal-body {
  padding: 16px;
  overflow-y: auto;
  line-height: 1.55;
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lv-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s, border-color 0.15s;
}
.lv-copy:hover {
  color: var(--text);
  border-color: var(--accent-text);
}
.lv-copy.is-copied {
  color: var(--accent-text);
  border-color: var(--accent-text);
}
.lv-copy svg {
  width: 14px;
  height: 14px;
}

.jira-summarize-plus {
  font-weight: 700;
  margin-right: 0.15rem;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.jira-references-footer {
  padding: 0.85rem 1.25rem;
  flex-shrink: 0;
}

.jira-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.jira-export-icon {
  font-size: 0.95rem;
}

.jira-muted {
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════════════════
   Redesign 2026 — brand refresh (orange-on-slate, bracket signature, themes)
   ════════════════════════════════════════════════════════════════════════ */

/* Primary buttons: orange fill takes dark-slate ink (legible + on-brand) */
.btn-primary { color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); }

/* Links/keys that used the old blue accent should track the legible accent */
.back-link,
.menu-card-link,
.inline-link,
.auth-footer a,
.scanner-browse { color: var(--accent-text); }

/* Brand wordmark in the top bar */
.brand-name { letter-spacing: -0.01em; color: var(--accent); }
.brand-name .brand-accent { color: var(--accent); }

/* Theme toggle button in the top bar */
.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { display: block; }
/* Show the correct glyph per theme */
.theme-toggle .ic-sun  { display: none; }
.theme-toggle .ic-moon { display: block; }
html[data-theme="light"] .theme-toggle .ic-sun  { display: block; }
html[data-theme="light"] .theme-toggle .ic-moon { display: none; }

/* Signature 1 — bracketed mono "kicker" eyebrow (hero/section labels) */
.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 0.55rem;
}
.kicker::before { content: "[ "; color: var(--text-faint); }
.kicker::after  { content: " ]"; color: var(--text-faint); }

/* Signature 2 — bracketed mono ticket keys (the app's core noun) */
.key-chip {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent-text);
  white-space: nowrap;
  text-decoration: none;
}
.key-chip::before { content: "["; color: var(--text-faint); margin-right: 1px; }
.key-chip::after  { content: "]"; color: var(--text-faint); margin-left: 1px; }
.key-chip:hover { color: var(--accent); }

/* Signature 3 — bracket corner-ticks revealed on card hover */
.menu-card,
.dash-card { position: relative; overflow: hidden; }
.menu-card::before, .menu-card::after,
.dash-card::before, .dash-card::after {
  content: ""; position: absolute; width: 13px; height: 13px;
  border-color: var(--accent); border-style: solid; border-width: 0;
  opacity: 0; transition: opacity .16s;
  pointer-events: none;
}
.menu-card::before, .dash-card::before {
  top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px;
}
.menu-card::after, .dash-card::after {
  bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px;
}
.menu-card:hover::before, .menu-card:hover::after,
a.dash-card:hover::before, a.dash-card:hover::after { opacity: 1; }

/* Keyboard focus — visible orange ring across interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.admin-toggle-form {
  margin: 0;
}

.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.admin-checkbox input {
  cursor: pointer;
}

.admin-type-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Admin: add-user form */
.admin-add-user {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
}

.admin-add-user > summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.admin-add-user[open] > summary {
  border-bottom: 1px solid var(--border);
}

.admin-add-user-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem;
}

.admin-add-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
}

.admin-add-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-add-field > label {
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-add-field input,
.admin-add-user-form .email-input-group {
  min-width: 200px;
}

.admin-add-field input:not([type="checkbox"]) {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: inherit;
  font-size: 0.9rem;
}

.admin-add-admin {
  padding-bottom: 0.45rem;
}

/* ════════════════════════════════════════════════
   Sidebar navigation (dashboard-v2)
   ════════════════════════════════════════════════ */
.app-shell--sidebar {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidenav {
  --sidenav-w: 244px;
  width: var(--sidenav-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 60;
}

.sidenav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.sidenav-head .brand-name { font-size: 0.95rem; }

.sidenav-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
}
.sidenav-close:hover { color: var(--text); background: var(--surface-elevated); }

.sidenav-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.6rem 1rem;
}

.sidenav-group { margin-bottom: 1.05rem; }
.sidenav-group:last-child { margin-bottom: 0.25rem; }

.sidenav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.6rem;
  margin-bottom: 0.4rem;
  opacity: 0.85;
}

.sidenav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background 0.14s, color 0.14s;
}
.sidenav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.14s;
}
.sidenav-link span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidenav-link:hover {
  background: var(--surface-elevated);
}
.sidenav-link:hover svg { color: var(--text); }

.sidenav-link.is-active {
  background: var(--accent-tint);
  color: var(--accent-text);
  font-weight: 600;
}
.sidenav-link.is-active svg { color: var(--accent-text); }

.sidenav-link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.sidenav-link--admin svg { color: #c084fc; }
.sidenav-link--admin:hover { background: rgba(168, 85, 247, 0.1); }
.sidenav-link--admin.is-active {
  background: rgba(168, 85, 247, 0.14);
  color: #c084fc;
}
.sidenav-link--admin.is-active svg { color: #c084fc; }

/* Credentials link when the Jira API key isn't set — blinking red to nag. */
.sidenav-link--alert,
.sidenav-link--alert svg {
  color: #ef4444;
  animation: sidenav-alert-blink 1.1s steps(1, end) infinite;
}
.sidenav-link--alert:hover { background: rgba(239, 68, 68, 0.12); }
@keyframes sidenav-alert-blink {
  0%, 49% { color: #ef4444; }
  50%, 100% { color: var(--text-dim, #9aa4b2); }
}
@media (prefers-reduced-motion: reduce) {
  .sidenav-link--alert,
  .sidenav-link--alert svg { animation: none; color: #ef4444; }
}

/* Collapsible "Tools" group toggle */
.sidenav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
.sidenav-toggle .sidenav-toggle-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.sidenav-group--collapsible.is-open .sidenav-toggle-chevron {
  transform: rotate(180deg);
}
/* Collapse via grid-rows trick so it animates without a fixed height. */
.sidenav-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.18s ease;
}
.sidenav-collapse > .sidenav-collapse-inner { min-height: 0; overflow: hidden; }
.sidenav-group--collapsible.is-open .sidenav-collapse {
  grid-template-rows: 1fr;
}

.sidenav-foot {
  border-top: 1px solid var(--border);
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sidenav-foot .sidenav-link--guide { margin: 0 -0.3rem 0.15rem; }
.sidenav-foot .connection-pill { align-self: flex-start; }
.sidenav-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.sidenav-foot .user-pill {
  font-size: 0.78rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidenav-signout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.sidenav-signout svg { width: 17px; height: 17px; }
.sidenav-signout:hover { background: var(--surface-elevated); color: var(--text); }

/* main column beside the sidebar */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.app-shell--sidebar .content {
  flex: 1;
}

/* mobile-only top bar with hamburger */
.mobilebar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobilebar-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
}
.mobilebar .brand-name { font-size: 0.9rem; }

.sidenav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}

/* ── desktop: collapsible (foldable) sidebar ── */
.sidenav-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
}
.sidenav-collapse-btn:hover { color: var(--text); background: var(--surface-elevated); }

/* floating re-open button, hidden until the sidebar is folded away */
.sidenav-expand-btn {
  display: none;
  position: fixed;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 65;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.sidenav-expand-btn:hover { background: var(--surface-elevated); }

/* when folded: hide the sidenav entirely and surface the floating opener */
.app-shell--sidebar.sidenav--collapsed > .sidenav { display: none; }
.app-shell--sidebar.sidenav--collapsed .sidenav-expand-btn { display: inline-flex; }

@media (max-width: 900px) {
  /* on mobile the drawer model already handles this — hide desktop fold controls */
  .sidenav-collapse-btn { display: none; }
  .app-shell--sidebar.sidenav--collapsed > .sidenav { display: flex; }
  .app-shell--sidebar.sidenav--collapsed .sidenav-expand-btn { display: none; }
}

/* ── mobile: sidebar becomes an off-canvas drawer ── */
@media (max-width: 900px) {
  .mobilebar { display: flex; }
  .sidenav-close { display: inline-flex; }
  .sidenav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .sidenav.sidenav--open { transform: translateX(0); }
}

/* ── sidebar-v2: reconcile full-height pages (cc-app / scanner-app) with the sidebar row layout ──
   The legacy .app-shell:has(.cc-app)/:has(.scanner-app) rules force the shell to a
   clipped flex-column. With the sidebar the shell must stay a row (sidebar | main);
   the full-height + overflow clipping moves to the inner .app-main column instead. */
.app-shell--sidebar:has(.cc-app),
.app-shell--sidebar:has(.scanner-app) {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}
.app-shell--sidebar:has(.cc-app) .app-main,
.app-shell--sidebar:has(.scanner-app) .app-main {
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 900px) {
  /* mobile: drawer sidebar is fixed/off-canvas — let these pages scroll the page again */
  .app-shell--sidebar:has(.cc-app),
  .app-shell--sidebar:has(.scanner-app) {
    height: auto;
    overflow: visible;
  }
  .app-shell--sidebar:has(.cc-app) .app-main,
  .app-shell--sidebar:has(.scanner-app) .app-main {
    height: auto;
    overflow: visible;
  }
}

/* ── SAML SSO (Okta) sign-in ──────────────────────────────────────────────── */
.btn-sso {
  margin-bottom: 0.5rem;
  text-align: center;
  text-decoration: none;
}
.btn-sso:hover {
  text-decoration: none;
}
.auth-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Global search bar (base.html, all authed pages) ──────────────────────── */
.gsearch {
  /* Pulled out of flow so it adds ZERO vertical height — content paints from
     the left, the bar floats top-right over the padding gutter above it. */
  position: absolute;
  top: 0.9rem;
  right: 2rem;
  width: min(420px, 45vw);
  z-index: 200;
}
.gsearch-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 0.6rem;
  height: 34px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gsearch-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.gsearch-icon { color: var(--text-faint); flex: none; }
.gsearch-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
  min-width: 0;
}
.gsearch-input::placeholder { color: var(--text-faint); }
.gsearch-kbd {
  flex: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  line-height: 1.4;
}
.gsearch-box:focus-within .gsearch-kbd { display: none; }
.gsearch-clear {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 6px;
}
.gsearch-clear:hover { color: var(--text); background: var(--surface-elevated); }

.gsearch-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  max-height: min(60vh, 460px);
  overflow-y: auto;
  z-index: 210;
}
.gsearch-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}
.gsearch-item[aria-selected="true"],
.gsearch-item:hover { background: var(--accent-tint); }
.gsearch-item-icon {
  flex: none;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
}
.gsearch-item-icon svg { width: 16px; height: 16px; }
.gsearch-item--jira .gsearch-item-icon,
.gsearch-item--case .gsearch-item-icon { color: var(--accent-text); }
.gsearch-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gsearch-item-label {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsearch-item-sub {
  color: var(--text-faint);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsearch-item-tag {
  flex: none;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
}
.gsearch-item--jira .gsearch-item-tag,
.gsearch-item--case .gsearch-item-tag {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-tint);
}

@media (max-width: 768px) {
  /* Back in flow on mobile so it doesn't overlap the sticky hamburger bar. */
  .gsearch { position: static; width: auto; margin: 0.5rem 1rem 0; }
  .gsearch-list { left: 0; right: 0; }
  .gsearch-kbd { display: none; }
}

/* ── Live P1 alert banners (top of every page, Product/+SFDC/admin) ── */
.p1-alerts {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.p1-alerts:empty { display: none; }

.p1-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.15);
  /* Enter/exit transition (JS toggles .is-in / .is-out). */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.p1-alert.is-in { opacity: 1; transform: translateY(0); }
.p1-alert.is-out { opacity: 0; transform: translateY(-6px); }
.p1-alert:hover { border-color: rgba(239, 68, 68, 0.7); }

.p1-alert-tag {
  flex: none;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  color: #fff;
  background: #ef4444;
  white-space: nowrap;
}
.p1-alert-num {
  flex: none;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--text);
}
.p1-alert-cust {
  flex: none;
  font-weight: 600;
  color: var(--text);
}
.p1-alert-subj {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p1-alert-close {
  flex: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}
.p1-alert-close:hover { color: var(--text); background: rgba(239, 68, 68, 0.18); }

@media (max-width: 640px) {
  .p1-alert { flex-wrap: wrap; gap: 0.4rem 0.6rem; }
  .p1-alert-subj { flex-basis: 100%; white-space: normal; }
}
