/* ==========================================================================
   CloudTrim Enterprise Edition - Corporate Design System (Fluent 2 Standard)
   ========================================================================== */

:root {
  /* Microsoft Corporate Blue & Neutral Slate Palette */
  --ms-blue-600: #0078d4;
  --ms-blue-700: #106ebe;
  --ms-blue-800: #005a9e;
  --ms-blue-50: #eff6fc;
  --ms-blue-100: #deecf9;
  
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;

  /* Semantic Alerts */
  --danger-600: #d13438;
  --danger-50: #fdf3f4;
  --danger-border: #f8d7da;
  --warning-600: #b45309;
  --warning-50: #fffbeb;
  --warning-border: #fde68a;
  --success-600: #107c41;
  --success-50: #ecfdf5;
  --success-border: #a7f3d0;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;

  /* Layout & Elevations */
  --sidebar-width: 250px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background-color: #f3f5f8;
  color: var(--slate-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. GLOBAL ENTERPRISE APP HEADER
   ========================================================================== */
.global-header {
  background: var(--slate-900);
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-title {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-title svg {
  width: 20px;
  height: 20px;
  color: #38bdf8;
}
.tenant-selector {
  background: var(--slate-800);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tenant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.currency-pill {
  background: var(--slate-800);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  padding: 2px;
}
.curr-btn {
  background: none;
  border: none;
  color: var(--slate-400);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.curr-btn.active {
  background: var(--ms-blue-600);
  color: var(--white);
}

/* ==========================================================================
   2. APP LAYOUT STRUCTURE (Sidebar + Content Workspace)
   ========================================================================== */
.app-layout {
  display: flex;
  flex: 1;
}
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--slate-200);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 20px 8px;
}
.nav-menu {
  list-style: none;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.12s ease;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: var(--slate-50);
  color: var(--slate-900);
}
.nav-item.active {
  background: var(--ms-blue-50);
  color: var(--ms-blue-700);
  font-weight: 600;
  border-left-color: var(--ms-blue-600);
}
.nav-item-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-item svg { width: 17px; height: 17px; }
.nav-badge {
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
}
.nav-item.active .nav-badge {
  background: var(--ms-blue-100);
  color: var(--ms-blue-800);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--slate-200);
  font-size: 0.75rem;
  color: var(--slate-500);
}
.sidebar-footer strong { color: var(--slate-700); }

/* Main Workspace */
.app-main {
  flex: 1;
  padding: 24px 32px;
  max-width: 1320px;
}

/* Sub-nav Context Breadcrumb Bar */
.workspace-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}
.context-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}
.context-meta {
  font-size: 0.8rem;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.topbar-actions {
  display: flex;
  gap: 10px;
}

/* Button UI */
.btn {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn-secondary {
  background: var(--white);
  border-color: var(--slate-300);
  color: var(--slate-700);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}
.btn-primary {
  background: var(--ms-blue-600);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--ms-blue-700);
}

/* ==========================================================================
   3. CORPORATE KPI CARDS & GOVERNANCE SCORE
   ========================================================================== */
.kpi-deck {
  display: grid;
  grid-template-columns: 260px repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.score-widget {
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.score-circle-outer {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: conic-gradient(var(--success-600) 0% 74%, var(--slate-200) 74% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 6px;
}
.score-circle-inner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--slate-900);
}
.score-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
}

.kpi-tile {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-heading {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kpi-stat {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  margin: 6px 0 2px;
}
.kpi-stat.danger { color: var(--danger-600); }
.kpi-sub {
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* ==========================================================================
   4. INGESTION SUITE & ZERO-ACCESS ASSURANCE
   ========================================================================== */
.ingest-suite {
  padding: 20px;
  margin-bottom: 24px;
}
.ingest-suite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.ingest-suite-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--slate-900);
}
.security-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success-600);
  background: var(--success-50);
  border: 1px solid var(--success-border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.drop-boundary {
  border: 2px dashed #94a3b8;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.drop-boundary:hover, .drop-boundary.drag-over {
  border-color: var(--ms-blue-600);
  background: var(--ms-blue-50);
}
.drop-boundary h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 4px;
}
.drop-boundary p {
  font-size: 0.8rem;
  color: var(--slate-500);
}

/* ==========================================================================
   5. ANALYTICS GRAPHS (Chart.js Grid)
   ========================================================================== */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card {
  padding: 20px;
}
.chart-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.chart-heading {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--slate-800);
}
.chart-holder {
  height: 210px;
  position: relative;
}

/* ==========================================================================
   6. ENTERPRISE DATA TABLES
   ========================================================================== */
.table-card {
  overflow: hidden;
  margin-bottom: 24px;
}
.table-toolbar {
  padding: 12px 18px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-tabs {
  display: flex;
  gap: 6px;
}
.filter-btn {
  background: var(--white);
  border: 1px solid var(--slate-300);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.12s ease;
}
.filter-btn.active {
  background: var(--ms-blue-600);
  border-color: var(--ms-blue-600);
  color: var(--white);
}
.table-search {
  padding: 6px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  width: 250px;
  font-family: var(--font-sans);
}
.table-search:focus {
  outline: none;
  border-color: var(--ms-blue-600);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
th {
  background: var(--white);
  padding: 11px 18px;
  text-align: left;
  font-weight: 600;
  color: var(--slate-600);
  border-bottom: 1px solid var(--slate-200);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-800);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbfcfe; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-danger { background: var(--danger-50); color: var(--danger-600); border: 1px solid var(--danger-border); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); border: 1px solid var(--warning-border); }
.badge-neutral { background: var(--slate-100); color: var(--slate-700); }

/* ==========================================================================
   7. POWERSHELL TERMINAL & RECURRING ENGINE PANELS
   ========================================================================== */
.terminal-block {
  background: #0f172a;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 10px;
}
.terminal-head {
  background: #1e293b;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #94a3b8;
}
.terminal-content {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e2e8f0;
  overflow-x: auto;
  line-height: 1.6;
}
.syn-comment { color: #64748b; }
.syn-cmd { color: #38bdf8; font-weight: 600; }
.syn-param { color: #f472b6; }
.syn-str { color: #a7f3d0; }

/* Interactive Toggle Switch for Safe Dry Run Mode */
.toggle-switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--slate-700);
  font-weight: 600;
}
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--ms-blue-600); }
input:checked + .slider:before { transform: translateX(16px); }

/* Interactive Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--slate-900);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   8. PRINT SPECIFICATION (Executive CFO Format)
   ========================================================================== */
@media print {
  body { background: white; }
  .global-header, .app-sidebar, .topbar-actions, .ingest-suite, .table-toolbar, #view-remediation, #view-automation, .toast-notice {
    display: none !important;
  }
  .app-layout { display: block; }
  .app-main { padding: 0; max-width: 100%; }
  .analytics-grid { grid-template-columns: 1fr 1fr; page-break-inside: avoid; }
  .card { border: 1px solid #cbd5e1; box-shadow: none; page-break-inside: avoid; margin-bottom: 20px; }
}

@media (max-width: 1100px) {
  .kpi-deck { grid-template-columns: 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
}
