:root {
  --bg-main: #0B0F19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(16, 185, 129, 0.3);
  
  --primary: #10B981;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --primary-dark: #059669;
  --secondary: #3B82F6;
  --accent: #8B5CF6;
  
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;
  
  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;
  --info: #3B82F6;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Header */
.header {
  height: 70px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.logo-badge {
  background: linear-gradient(135deg, #10B981, #3B82F6);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--border-accent);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

/* Layout */
.container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  flex: 1;
}

/* KPI Banner */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.kpi-card:hover::after {
  opacity: 1;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Glass Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Sub Navigation for Interaction Hub */
.sub-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.sub-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.sub-nav-btn.active {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--border-accent);
}

.sub-tab-panel {
  display: none;
}

.sub-tab-panel.active {
  display: block;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: #fff;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

/* Chat Layout */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  height: calc(100vh - 250px);
}

.preset-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preset-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--primary);
}

.preset-title {
  font-weight: 600;
  font-size: 0.825rem;
}

.preset-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg {
  display: flex;
  gap: 0.85rem;
  max-width: 85%;
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.msg.agent .msg-avatar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.msg-content {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.15rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.msg.user .msg-content {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--border-accent);
}

.msg-content h1, .msg-content h2, .msg-content h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  color: var(--primary);
}

.msg-content h1:first-child, .msg-content h2:first-child {
  margin-top: 0;
}

.msg-content ul, .msg-content ol {
  margin-left: 1.1rem;
  margin-bottom: 0.5rem;
}

.msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}

.msg-content th, .msg-content td {
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.msg-content th {
  background: rgba(255, 255, 255, 0.05);
}

.msg-content code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #34D399;
}

.chat-input-bar {
  padding: 0.85rem 1rem;
  background: rgba(11, 15, 25, 0.6);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.6rem;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  color: #fff;
  font-size: 0.875rem;
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: var(--primary);
}

.send-btn {
  background: var(--primary);
  color: #0B0F19;
  border: none;
  border-radius: 10px;
  padding: 0 1.25rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.send-btn:hover {
  background: #34D399;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

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

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.02);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge.critical {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.high {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.medium {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.low, .badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Action Buttons */
.btn-action {
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-approve {
  background: var(--primary);
  color: #0B0F19;
}
.btn-approve:hover { background: #34D399; }

.btn-reject {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-reject:hover { background: rgba(239, 68, 68, 0.4); }

/* Progress bar */
.progress-container {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  height: 8px;
  width: 100%;
  overflow: hidden;
  margin-top: 0.35rem;
}

.progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  height: 100%;
  border-radius: 20px;
  transition: width 0.4s ease;
}
