@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --blue: #0a4f8c;
  --blue-dark: #073a68;
  --blue-deep: #052849;
  --blue-light: #e8f1fb;
  --blue-accent: #1c7ed6;
  --gold: #c9a961;
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #64748b;
  --border: #e6ebf2;
  --danger: #b3261e;
  --shadow: 0 4px 20px rgba(10, 79, 140, 0.08);
  --shadow-lg: 0 12px 40px rgba(7, 58, 104, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at top right, rgba(28, 126, 214, 0.06), transparent 45%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-dark) 60%, var(--blue));
  color: white;
  box-shadow: 0 2px 16px rgba(5, 40, 73, 0.25);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand {
  color: white;
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.topbar .brand span { font-weight: 400; opacity: 0.75; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 4px; }

.topbar nav a, .topbar nav .link-btn {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  margin-left: 24px;
  font-size: 0.92rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}
.topbar nav a:hover, .topbar nav .link-btn:hover { color: var(--gold); text-decoration: none; }
.topbar .btn-outline-nav {
  border: 1px solid rgba(255,255,255,0.5);
  padding: 7px 16px;
  border-radius: 999px;
  transition: all 0.2s;
}
.topbar .btn-outline-nav:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--gold);
  color: white;
}
.inline-form { display: inline; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 32px;
}
.container.narrow { max-width: 520px; }

h1 { font-family: 'Poppins', sans-serif; font-size: 1.85rem; font-weight: 700; color: var(--blue-deep); margin-bottom: 6px; letter-spacing: -0.01em; }
h2 { font-family: 'Poppins', sans-serif; font-size: 1.2rem; font-weight: 600; color: var(--blue-dark); margin-top: 36px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card.center { text-align: center; }

a.section-card { text-decoration: none; color: inherit; display: block; transition: box-shadow 0.2s, transform 0.2s; }
a.section-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
a.section-card.highlight { border-color: var(--blue); background: linear-gradient(160deg, #ffffff, var(--blue-light)); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 14px;
}

.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; color: var(--blue-dark); }
.form input, .form select, .form textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 3px rgba(28, 126, 214, 0.12);
  background: white;
}
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400; color: var(--text); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-accent), var(--blue));
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(10, 79, 140, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(10, 79, 140, 0.36); }

.btn-outline {
  display: inline-block;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-outline:hover { background: var(--blue); color: white; }

.link-btn { background: none; border: none; color: var(--blue-accent); cursor: pointer; text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

.alert { background: #fff8ea; border: 1px solid var(--gold); padding: 14px 18px; border-radius: 10px; margin: 16px 0; }
.alert-error { background: #fdecea; border-color: #f5b4ae; color: var(--danger); }

.table { width: 100%; border-collapse: collapse; margin-top: 14px; background: white; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; padding: 12px 16px; background: var(--blue-light); color: var(--blue-dark); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table tr:last-child td { border-bottom: none; }

.doc-list { list-style: none; padding: 0; }
.doc-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-list a { color: var(--blue-accent); text-decoration: none; font-weight: 600; }
.doc-list a:hover { text-decoration: underline; }

.chat-shell {
  display: flex;
  flex-direction: column;
  height: min(72vh, 720px);
  min-height: 380px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 18px;
}
.chat-shell-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex: 0 0 auto;
}
.chat-shell-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-accent), var(--blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: 0 0 auto;
}
.chat-shell-header strong { display: block; font-size: 0.95rem; }
.chat-shell-status { font-size: 0.78rem; color: var(--muted, #7a8699); }
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bubble-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; align-self: flex-start; }
.bubble-row.user { flex-direction: row-reverse; align-self: flex-end; }
.bubble-avatar { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.bubble-avatar.bot { background: var(--blue-light); }
.bubble-avatar.user { background: linear-gradient(135deg, var(--blue-accent), var(--blue)); color: #fff; }
.bubble {
  max-width: min(78%, 560px);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bubble a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.bubble-user { background: linear-gradient(135deg, var(--blue-accent), var(--blue)); color: white; border-bottom-right-radius: 4px; }
.bubble-bot { background: var(--blue-light); color: var(--text); border-bottom-left-radius: 4px; }
.bubble-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.bubble-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-accent); opacity: 0.5; animation: chatTyping 1s infinite ease-in-out; }
.bubble-typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatTyping { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

.chat-form { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: #fff; flex: 0 0 auto; }
.chat-form textarea { flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; font-family: inherit; font-size: 0.95rem; resize: none; max-height: 140px; line-height: 1.4; transition: border-color 0.15s, box-shadow 0.15s; }
.chat-form .btn-primary { align-self: flex-end; }
.chat-form textarea:focus


  .brand-logo { height: 26px; width: auto; vertical-align: middle; display: inline-block; }
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; }


           @media (max-width: 640px) {
             .topbar { flex-wrap: wrap; row-gap: 12px; padding: 14px 20px; }
             .topbar .brand { flex: 1 0 auto; }
             .brand-logo { height: 22px; }
             .topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; width: 100%; }
             .topbar nav a, .topbar nav .link-btn { margin-left: 0; }
             .topbar .btn-outline-nav { padding: 6px 12px; }
             .container { padding: 24px 18px; }
           }


@media (max-width: 640px) {
  .chat-shell { height: calc(100svh - 230px); min-height: 340px; border-radius: 14px; }
  .bubble { max-width: 86%; }
}


.chat-shell-avatar { overflow: hidden; }
.chat-shell-avatar img.chat-avatar-logo { width: 60%; height: 60%; object-fit: contain; }
.bubble-avatar.bot { background: linear-gradient(135deg, var(--blue-accent), var(--blue)); padding: 5px; box-sizing: border-box; overflow: hidden; }
.bubble-avatar.bot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bubble-avatar.user { background: #eef2f6; color: #5b7a99; }
.bubble-avatar.user svg { display: block; }
