/* OPS Management UI — app shell, workspace, tabs, modals */

.app-manage .site-header { border-bottom-color: var(--border); }
.header-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 140px);
}

.app-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-section { padding: 0 0.75rem 1rem; }
.sidebar-section-staff { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 0.5rem; }
.sidebar-section-account { margin-top: auto; border-top: 1px solid var(--border); padding-top: 1rem; }
.sidebar-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 0.75rem 0.5rem;
  font-weight: 700;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); text-decoration: none; }
.sidebar-link.is-active {
  background: rgba(30, 77, 140, 0.35);
  color: #9ec8ff;
  border-left: 3px solid var(--accent-2);
  padding-left: calc(0.75rem - 3px);
}
.sidebar-icon { opacity: 0.7; font-size: 0.85rem; width: 1rem; text-align: center; }

.workspace { min-width: 0; background: var(--bg); }
.workspace-inner { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.75rem 3rem; }

.breadcrumbs { padding: 1rem 1.75rem 0; font-size: 0.85rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.breadcrumbs li::after { content: "/"; margin-left: 0.35rem; color: var(--muted); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs [aria-current="page"] { color: var(--text); }

.workspace-header { margin-bottom: 1.5rem; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.lead-compact { margin: 0.35rem 0 0; max-width: 40rem; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}
.stat-card .stat-value { font-family: var(--display); font-size: 2.25rem; color: var(--accent); line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.35rem; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { color: #9ec8ff; border-bottom-color: var(--accent-2); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.panel-title { font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.04em; margin: 0; }

/* Forms grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.form-grid label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.75rem; }
.form-grid input, .form-grid select, .form-grid textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.form-grid textarea { min-height: 80px; resize: vertical; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.empty-state-icon { font-size: 2rem; opacity: 0.4; margin-bottom: 0.75rem; }
.empty-state h3 { margin: 0 0 0.5rem; font-family: var(--display); letter-spacing: 0.04em; }

/* Toast */
.toast-root {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toast-in 0.2s ease;
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Modal */
.modal-root[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal h2 { margin-top: 0; font-family: var(--display); letter-spacing: 0.04em; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Loading */
.is-loading { opacity: 0.55; pointer-events: none; }
.spinner-inline::after {
  content: " …";
  animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* Action row in tables */
.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Mobile */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: relative;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-section { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; padding-bottom: 0.5rem; }
  .sidebar-label { width: 100%; }
  .sidebar-section-account { border-top: none; }
}