/* ── Variables Prtech ──────────────────────────────────────────────────────── */
:root {
  --prtech-primary:  #1565C0;
  --prtech-dark:     #0D1B2A;
  --prtech-surface:  #1B2A3B;
  --prtech-surface2: #243447;
  --prtech-border:   #2E4057;
  --prtech-accent:   #F59E0B;
  --sidebar-width:   230px;
}

/* ── Global ────────────────────────────────────────────────────────────────── */
body { background: var(--prtech-dark); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: #101C2B;
  border-right: 1px solid var(--prtech-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand {
  background: var(--prtech-primary);
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand-name { font-size: 1.4rem; font-weight: 800; color: #fff; letter-spacing: 2px; }
.brand-sub  { font-size: 0.85rem; color: var(--prtech-accent); font-weight: 500; }
.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.7rem 1.2rem;
  color: #8A9BB0;
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}
.sidebar-link:hover { background: var(--prtech-surface); color: #fff; }
.sidebar-link.active {
  background: rgba(21,101,192,0.15);
  color: #fff;
  border-left-color: var(--prtech-primary);
  font-weight: 600;
}
.sidebar-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--prtech-border);
  padding: 0.5rem;
}
.user-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--prtech-surface2);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.5rem;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--prtech-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; color: #fff; font-size: 0.9rem;
  flex-shrink: 0;
}
.user-name  { font-size: 0.8rem; font-weight: 600; color: #fff; line-height: 1.2; }
.user-email { font-size: 0.7rem; color: #8A9BB0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  height: 54px;
  background: var(--prtech-surface);
  border-bottom: 1px solid var(--prtech-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.breadcrumb-title { font-weight: 600; color: #fff; font-size: 0.95rem; }

/* ── Main content ──────────────────────────────────────────────────────────── */
.main-content { background: var(--prtech-dark); overflow-y: auto; }
.content-area { padding: 1.5rem; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.prtech-card { background: var(--prtech-surface); border: 1px solid var(--prtech-border); border-radius: 10px; }
.prtech-card .card-header { background: var(--prtech-surface2); border-bottom: 1px solid var(--prtech-border); }
.section-header { color: #fff; font-weight: 600; font-size: 0.9rem; }

/* ── KPI Cards ─────────────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--prtech-surface);
  border: 1px solid var(--prtech-border);
  border-radius: 10px;
  padding: 1rem 0.75rem;
  text-align: center;
}
.kpi-icon  { font-size: 1.6rem; margin-bottom: 0.3rem; }
.kpi-value { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.kpi-label { font-size: 0.72rem; color: #8A9BB0; margin-top: 0.2rem; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table { color: #E2E8F0; }
.table thead th { background: var(--prtech-primary); color: #fff; font-size: 0.82rem; font-weight: 600; border: none; }
.table tbody td { border-color: var(--prtech-border); font-size: 0.88rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(255,255,255,0.04); }

/* ── Totals box ────────────────────────────────────────────────────────────── */
.totals-box { font-size: 0.9rem; }
.total-row  { border-top: 2px solid var(--prtech-accent) !important; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--prtech-dark);
  border-color: var(--prtech-border);
  color: #E2E8F0;
  font-size: 0.88rem;
}
.form-control:focus, .form-select:focus {
  background: var(--prtech-dark);
  border-color: var(--prtech-primary);
  color: #E2E8F0;
  box-shadow: 0 0 0 0.2rem rgba(21,101,192,0.25);
}
.form-label { font-size: 0.82rem; color: #8A9BB0; margin-bottom: 0.3rem; }
.input-group-text { background: var(--prtech-surface2); border-color: var(--prtech-border); color: #8A9BB0; }
textarea.form-control { resize: vertical; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary   { background: var(--prtech-primary); border-color: var(--prtech-primary); }
.btn-primary:hover { background: #1976D2; border-color: #1976D2; }

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-page { background: var(--prtech-dark); min-height: 100vh; margin: 0; }
.login-container {
  display: flex;
  min-height: 100vh;
}
.login-brand {
  flex: 1;
  background: linear-gradient(135deg, #0D1B2A 0%, #1565C0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
.login-brand-inner { max-width: 400px; color: #fff; }
.login-logo {
  width: 70px; height: 70px;
  background: rgba(255,255,255,0.15);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 900;
  margin-bottom: 1.5rem;
  border: 2px solid rgba(255,255,255,0.3);
}
.logo-p { color: #fff; font-family: 'Segoe UI', sans-serif; }
.login-company  { font-size: 2rem; font-weight: 800; letter-spacing: 3px; margin: 0; }
.login-tagline  { color: rgba(255,255,255,0.6); font-size: 0.9rem; margin-bottom: 1rem; }
.login-divider  { height: 2px; background: var(--prtech-accent); width: 50px; margin: 1rem 0; }
.login-product  { font-size: 1.4rem; font-weight: 700; color: var(--prtech-accent); margin: 0; }
.login-product-desc { color: rgba(255,255,255,0.6); font-size: 0.88rem; margin-top: 0.5rem; }
.feature-item   { color: rgba(255,255,255,0.75); font-size: 0.85rem; padding: 0.3rem 0; }

.login-form-panel {
  width: 440px;
  background: var(--prtech-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-form-inner { width: 100%; max-width: 360px; }
.login-title    { font-size: 1.6rem; font-weight: 700; color: #fff; margin-bottom: 0.25rem; }
.login-subtitle { color: #8A9BB0; font-size: 0.88rem; margin-bottom: 1.5rem; }
.login-desc-box {
  background: rgba(21,101,192,0.15);
  border: 1px solid rgba(21,101,192,0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #B0C4DE;
  margin-bottom: 1.5rem;
}
.btn-microsoft {
  background: #fff;
  color: #333;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
}
.btn-microsoft:hover { background: #f0f0f0; box-shadow: 0 4px 12px rgba(0,0,0,0.3); color: #333; }
.login-footer-note { text-align: center; color: #8A9BB0; font-size: 0.75rem; margin-top: 1.5rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .login-brand { display: none; }
  .login-form-panel { width: 100%; }
  .sidebar { position: fixed; left: -230px; transition: left 0.3s; }
  .sidebar.show { left: 0; }
}
.cursor-pointer { cursor: pointer; }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
.badge { font-weight: 500; }
.upload-zone { border: 1px dashed var(--prtech-border); border-radius: 8px; padding: 1rem; }
code { background: var(--prtech-surface2); padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.82rem; color: var(--prtech-accent); }

/* ── Chat ───────────────────────────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Suggestions */
.chat-suggestions-panel {
  padding: 1rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--prtech-border);
  background: var(--prtech-surface);
  flex-shrink: 0;
}
.chat-suggestions-label {
  font-size: 0.78rem;
  color: #8A9BB0;
  margin-bottom: 0.5rem;
}
.chat-suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chat-suggestion-btn {
  background: var(--prtech-surface2);
  border: 1px solid var(--prtech-border);
  color: #B0C4DE;
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chat-suggestion-btn:hover {
  background: rgba(21,101,192,0.2);
  border-color: var(--prtech-primary);
  color: #fff;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  max-width: 85%;
}
.chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg-ai  { align-self: flex-start; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(21,101,192,0.25);
  border: 1px solid var(--prtech-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--prtech-primary);
  flex-shrink: 0;
}

.chat-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
}
.chat-bubble-user {
  background: var(--prtech-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
  background: var(--prtech-surface);
  border: 1px solid var(--prtech-border);
  color: #E2E8F0;
  border-bottom-left-radius: 4px;
}

/* Markdown inside AI bubble */
.chat-bubble-ai p:last-child { margin-bottom: 0; }
.chat-bubble-ai table {
  border-collapse: collapse;
  font-size: 0.82rem;
  width: 100%;
  margin: 0.5rem 0;
}
.chat-bubble-ai th {
  background: var(--prtech-primary);
  color: #fff;
  padding: 0.35rem 0.6rem;
  text-align: left;
}
.chat-bubble-ai td {
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--prtech-border);
  color: #CBD5E1;
}
.chat-bubble-ai tr:last-child td { border-bottom: none; }
.chat-bubble-ai strong { color: #fff; }
.chat-bubble-ai code {
  background: var(--prtech-surface2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--prtech-accent);
}
.chat-bubble-ai ul, .chat-bubble-ai ol {
  padding-left: 1.25rem;
  margin: 0.3rem 0;
}
.chat-bubble-ai li { margin-bottom: 0.15rem; }

/* Tool call indicator */
.chat-tool-indicator {
  align-self: flex-start;
  background: rgba(21,101,192,0.12);
  border: 1px solid rgba(21,101,192,0.3);
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  color: #7DB8F7;
  display: flex;
  align-items: center;
  margin-left: 2.5rem;
}

/* Typing dots */
@keyframes typingPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%            { opacity: 1;   transform: scale(1); }
}
.typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #8A9BB0;
  border-radius: 50%;
  margin: 0 2px;
  animation: typingPulse 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--prtech-border);
  background: var(--prtech-surface);
  padding: 0.85rem 1.25rem 0.6rem;
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}
.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--prtech-dark);
  border: 1px solid var(--prtech-border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.chat-input-wrapper:focus-within { border-color: var(--prtech-primary); }
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #E2E8F0;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  resize: none;
  min-height: 42px;
  max-height: 130px;
  line-height: 1.5;
}
.chat-send-btn {
  background: var(--prtech-primary);
  border: none;
  color: #fff;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.chat-send-btn:hover:not(:disabled) { background: #1976D2; }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-clear-btn {
  background: var(--prtech-surface2);
  border: 1px solid var(--prtech-border);
  color: #8A9BB0;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-clear-btn:hover { background: var(--prtech-border); color: #fff; }
.chat-hint {
  font-size: 0.7rem;
  color: #4A5568;
  margin-top: 0.35rem;
  padding-left: 0.25rem;
}
