/* ==========================================================================
   HOST EMPEROR - ENTERPRISE CLOUD SUITE & SECRETS VAULT
   Clean, Minimalist Solid Architectural Design System (No Gradients)
   ========================================================================== */

:root {
  /* Solid Color Palette - Architectural Slate & Solid Indigo */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #090d16;

  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-900: #312e81;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;

  /* Theme Tokens - Strict Solid Colors */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-sidebar: #090d16;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #1e293b;

  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-sidebar: #1e293b;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  /* Subtle Crisp Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: -0.011em;
}

input, button, select, textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Framework Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  color: #f1f5f9;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  border-right: 1px solid var(--border-sidebar);
  transition: transform 0.2s ease;
}

.sidebar-header {
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-sidebar);
}

.brand-badge {
  width: 36px;
  height: 36px;
  background: #0f172a;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #1e293b;
  flex-shrink: 0;
}

.brand-badge img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.brand-subtext {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Sidebar Menu */
.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  font-weight: 700;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #94a3b8;
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: #1e293b;
  color: #ffffff;
  font-weight: 600;
  border: 1px solid #334155;
}

.nav-item.active-gold {
  background: #1e293b;
  color: #fbbf24;
  font-weight: 600;
  border: 1px solid #334155;
}

.nav-item-badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-emerald-subtle {
  background: #064e3b;
  color: #34d399;
  border: 1px solid #059669;
}

.badge-amber-subtle {
  background: #78350f;
  color: #fbbf24;
  border: 1px solid #d97706;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border-sidebar);
  background: #060911;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid #334155;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-client-id {
  font-size: 0.68rem;
  color: #64748b;
  font-family: var(--font-mono);
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Navbar */
.app-topbar {
  height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-default);
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
}

.search-command-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  width: 320px;
  transition: all 0.15s ease;
}

.search-command-bar:focus-within {
  border-color: var(--slate-900);
  background: #ffffff;
}

.search-command-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.84rem;
  width: 100%;
  color: var(--text-main);
}

.search-hotkey {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: #ffffff;
  border: 1px solid var(--border-default);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.pulse-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-500);
}

.btn-signout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--slate-600);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-default);
  transition: all 0.15s ease;
}

.btn-signout:hover {
  background: var(--rose-50);
  color: var(--rose-600);
  border-color: var(--rose-100);
}

/* Page Body */
.page-container {
  padding: 28px;
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Breadcrumb & Header Title */
.page-header {
  margin-bottom: 24px;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.breadcrumb-item.active {
  color: var(--indigo-600);
  font-weight: 600;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.page-description {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Subscribed Service Hero Card (Clean Solid Slate) */
.service-hero-card {
  background: #090d16;
  border-radius: var(--radius-lg);
  border: 1px solid #1e293b;
  padding: 22px 24px;
  color: #ffffff;
  margin-bottom: 24px;
}

.hero-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.hero-service-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-service-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #0f172a;
  border: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-service-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.hero-service-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scope-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: #1e293b;
  color: #fbbf24;
  border: 1px solid #334155;
}

.hero-service-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-service-sub code {
  font-family: var(--font-mono);
  color: #cbd5e1;
  background: #1e293b;
  padding: 1px 5px;
  border-radius: 4px;
}

.hero-billing-tag {
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  text-align: right;
}

.billing-tag-rate {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fbbf24;
}

.billing-tag-term {
  font-size: 0.72rem;
  color: #34d399;
  font-weight: 600;
}

/* Stat Metric Grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 4px 0 2px;
  letter-spacing: -0.03em;
}

.metric-caption {
  font-size: 0.74rem;
  color: var(--emerald-600);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.box-indigo { background: var(--indigo-50); color: var(--indigo-600); }
.box-amber { background: var(--amber-50); color: var(--amber-600); }
.box-emerald { background: var(--emerald-50); color: var(--emerald-600); }
.box-slate { background: var(--slate-100); color: var(--slate-700); }

/* Panels & Tables */
.panel-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-tab-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

.tab-chip {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-chip:hover {
  color: var(--text-main);
}

.tab-chip.active {
  background: var(--slate-900);
  color: #ffffff;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Button System - Solid Fills Only */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--indigo-600);
  color: #ffffff;
  border-color: var(--indigo-700);
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--slate-700);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-accent {
  background: #d97706;
  color: #ffffff;
  border-color: #b45309;
}

.btn-accent:hover {
  background: #b45309;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.76rem;
}

/* Table Design */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 10px 16px;
  background: var(--bg-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border-default);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background-color: var(--bg-subtle);
}

/* Secret Vault Cell Components */
.secret-key-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--slate-900);
}

.secret-capsule {
  display: inline-flex;
  align-items: center;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 3px 6px 3px 10px;
  gap: 8px;
  max-width: 380px;
}

.secret-capsule .secret-raw {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.04em;
  user-select: none;
}

.capsule-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 3px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capsule-btn:hover {
  color: #ffffff;
  background: #1e293b;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.env-production {
  background: var(--rose-50);
  color: var(--rose-600);
  border: 1px solid var(--rose-100);
}

.env-staging {
  background: var(--amber-50);
  color: var(--amber-700);
  border: 1px solid var(--amber-100);
}

.env-development {
  background: var(--indigo-50);
  color: var(--indigo-700);
  border: 1px solid var(--indigo-100);
}

.status-pill-green {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-100);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Service Navigation Tabs */
.service-nav-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 24px;
  overflow-x: auto;
}

.service-nav-tab {
  padding: 9px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.service-nav-tab:hover {
  color: var(--text-main);
}

.service-nav-tab.active {
  color: var(--indigo-600);
  border-bottom-color: var(--indigo-600);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  padding: 16px;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
}

.modal-head {
  padding: 16px 20px;
  background: #090d16;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
}

.modal-head-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-content {
  padding: 20px;
}

.modal-foot {
  padding: 12px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-default);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form Elements */
.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--slate-800);
}

.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  background: #ffffff;
  color: var(--text-main);
}

.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--slate-900);
}

.field-mono {
  font-family: var(--font-mono);
}

/* Toast Notifications */
.toast-shelf {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: #090d16;
  color: #ffffff;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--emerald-500);
  border: 1px solid #1e293b;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: flex;
  }

  .search-command-bar {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 16px;
  }

  .app-topbar {
    padding: 0 16px;
  }

  .search-command-bar {
    display: none;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .service-hero-card {
    padding: 18px;
  }

  .hero-billing-tag {
    text-align: left;
    width: 100%;
  }

  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-tab-group {
    overflow-x: auto;
  }

  .panel-actions {
    justify-content: flex-start;
  }
}
