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

:root {
  --navy: #0b3a82;
  --blue: #0f4db8;
  --blue-action: #1e63d6;
  --blue-soft: #e9f1ff;
  --bg: #f2f4f7;
  --white: #ffffff;
  --text: #11243f;
  --muted: #5f6f86;
  --border: #d8e0ec;
  --ok: #1f7a44;
  --warn: #b96b00;
  --danger: #b42318;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: Inter, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.header {
  background: linear-gradient(120deg, var(--navy), var(--blue));
  color: var(--white);
  padding: 0 1.2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0a2f6a;
}
.hbrand { display: flex; align-items: center; gap: 10px; }
.hlogo {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--white);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.htitle { font-size: 0.96rem; font-weight: 700; }
.hsub { font-size: 0.68rem; color: #d8e6ff; letter-spacing: 0.06em; text-transform: uppercase; }
.hbadge {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--white);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}
.tab {
  cursor: pointer;
  padding: 13px 16px;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.tab-badge { background: var(--ok); color: white; border-radius: 999px; font-size: 0.63rem; padding: 2px 7px; }
.tab-badge.warn { background: var(--warn); }

.layout { display: grid; grid-template-columns: 320px 1fr; flex: 1; min-height: 0; overflow: hidden; }
.sidebar { background: #0b2f66; overflow-y: auto; }
.sb-section { padding: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.sb-label { color: #c8dcff; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; margin-bottom: 0.7rem; }
.acc-card {
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}
.acc-card.sel { border-color: #8eb7ff; background: rgba(255, 255, 255, 0.12); }
.acc-name { font-size: 0.82rem; font-weight: 700; }
.acc-desc { font-size: 0.72rem; color: #c8d8f3; margin-top: 3px; }
.acc-best { font-size: 0.68rem; color: #e0ecff; margin-top: 3px; }

.fill-progress { padding: 0.9rem 1rem; }
.fp-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.fp-label { color: #d7e6ff; font-size: 0.64rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.08em; }
.fp-pct { color: white; font-size: 0.9rem; font-weight: 700; }
.fp-bar { height: 7px; background: rgba(255, 255, 255, 0.15); border-radius: 999px; overflow: hidden; }
.fp-fill { height: 100%; background: linear-gradient(90deg, #8bb5ff, #d9e8ff); }
.fp-fields { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 4px; }
.fp-field { display: flex; justify-content: space-between; font-size: 0.68rem; color: #d7e6ff; gap: 8px; }
.fp-fval { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ffffff; }

.autofill-btn, .ai-fill-trigger, .submit-btn, .action-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 0.72rem 0.9rem;
  background: var(--blue-action);
  color: white;
  font-weight: 700;
  font-size: 0.81rem;
  cursor: pointer;
}
.autofill-btn:disabled, .ai-fill-trigger:disabled, .submit-btn:disabled, .action-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat-box { background: rgba(255, 255, 255, 0.08); border-radius: 7px; padding: 8px; text-align: center; }
.stat-num { color: white; font-size: 1rem; font-weight: 700; }
.stat-desc { color: #d5e5ff; font-size: 0.64rem; margin-top: 2px; }

.chat-panel, .form-panel { background: var(--white); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-head {
  background: linear-gradient(110deg, var(--navy), var(--blue));
  color: white;
  padding: 0.95rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.simba-info { display: flex; align-items: center; gap: 10px; }
.simba-av { width: 38px; height: 38px; border-radius: 8px; background: white; color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.simba-name { font-size: 0.9rem; font-weight: 700; }
.simba-role { font-size: 0.72rem; color: #d3e4ff; display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #35d07f; }
.reset-btn { border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; color: white; border-radius: 999px; padding: 6px 11px; font-size: 0.72rem; cursor: pointer; }

.messages { flex: 1; background: #f8faff; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.msg { max-width: 82%; display: flex; gap: 8px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.msg-av.ai { background: #d9e8ff; color: var(--navy); }
.msg-av.hu { background: #dfe3ea; color: #344054; }
.bubble-wrap { display: flex; flex-direction: column; gap: 3px; }
.bubble { border-radius: 10px; padding: 10px 12px; font-size: 0.82rem; line-height: 1.55; }
.msg.assistant .bubble { background: #e9f1ff; color: #18325f; border: 1px solid #d2e3ff; }
.msg.user .bubble { background: #eceff4; color: #1f2a37; border: 1px solid #d8e0ec; }
.bubble p { margin-bottom: 4px; }
.bubble ul { margin: 6px 0 4px 15px; }
.msg-time { font-size: 0.64rem; color: #6d7f9a; }
.msg.user .msg-time { text-align: right; }

.typing { padding: 9px 11px; border-radius: 8px; background: #e9f1ff; border: 1px solid #d2e3ff; display: flex; gap: 4px; }
.td { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }

.qreplies { border-top: 1px solid var(--border); background: white; padding: 0.7rem 1rem; display: flex; gap: 6px; flex-wrap: wrap; }
.qr { border: 1px solid #b8cefb; background: #f3f8ff; color: #1b3f7b; border-radius: 999px; font-size: 0.73rem; padding: 6px 11px; cursor: pointer; }

.chat-doc-bar { border-top: 1px solid var(--border); background: #f7faff; padding: 0.55rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-doc-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-doc-type { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 0.75rem; color: var(--text); background: white; }
.chat-upload-btn { border: 1px solid #aac7ff; border-radius: 8px; background: #eaf2ff; color: #153a78; font-size: 0.75rem; font-weight: 600; padding: 6px 10px; cursor: pointer; }
#chat-doc-input { display: none; }
.chat-doc-hint { font-size: 0.72rem; color: var(--muted); }

.input-area { background: white; border-top: 1px solid var(--border); padding: 0.75rem 1rem; display: flex; gap: 8px; }
.input-wrap { flex: 1; border: 1px solid var(--border); border-radius: 8px; background: #f8faff; }
.input-wrap:focus-within { border-color: var(--blue); }
.chat-input { width: 100%; border: none; outline: none; background: transparent; font-family: Inter, sans-serif; font-size: 0.83rem; color: var(--text); padding: 9px 11px; resize: none; }
.send-btn { width: 40px; border: none; border-radius: 8px; background: var(--blue-action); color: white; cursor: pointer; }
.send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.form-panel { overflow-y: auto; }
.form-inner { padding: 1.35rem; max-width: 940px; }
.form-header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--border); }
.form-title { font-size: 1.25rem; font-weight: 800; color: var(--navy); }
.form-sub { color: var(--muted); font-size: 0.78rem; }

.ai-banner {
  margin-bottom: 1rem;
  background: #edf4ff;
  border: 1px solid #d4e3ff;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.ai-banner-title { font-size: 0.86rem; font-weight: 700; color: #15366f; }
.ai-banner-desc { font-size: 0.75rem; color: #415674; margin-top: 3px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1rem; }
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 0.9rem;
}
.card-title { font-size: 0.82rem; font-weight: 700; color: var(--navy); margin-bottom: 0.55rem; }
.card-note { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }

.form-section { margin-bottom: 1.4rem; }
.section-header { display: flex; gap: 8px; align-items: center; margin-bottom: 0.8rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.section-title { font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.section-fill-count { margin-left: auto; color: var(--muted); font-size: 0.72rem; }
.fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 0.74rem; color: #43526a; font-weight: 600; }
.field-label .req { color: var(--danger); margin-left: 2px; }
.ai-badge {
  margin-left: 6px;
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #1e63d6;
  background: linear-gradient(90deg, #e7f0ff, #f3f8ff);
  border: 1px solid #bfd7ff;
  border-radius: 999px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 1px rgba(30, 99, 214, 0.06) inset;
}
.field-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faff;
  color: var(--text);
  padding: 9px 10px;
  font-size: 0.81rem;
  outline: none;
}
.field-input:focus { border-color: var(--blue); background: white; }
.field-input.ai-filled { background: #edf4ff; border-color: #b9d2ff; }
.field-input.invalid { border-color: var(--danger); background: #fff5f5; }

.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.doc-upload {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fafcff;
}
.doc-upload.required-missing { border-color: var(--danger); background: #fff5f5; }
.doc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; gap: 8px; }
.doc-name { font-size: 0.77rem; font-weight: 700; color: var(--navy); }
.doc-state { font-size: 0.68rem; font-weight: 700; }
.doc-state.ok { color: var(--ok); }
.doc-state.miss { color: var(--danger); }
.doc-files { margin-top: 6px; font-size: 0.7rem; color: var(--muted); line-height: 1.4; }

.terms-link { color: var(--blue); font-size: 0.72rem; text-decoration: underline; cursor: pointer; }
.review-box { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; display: flex; gap: 8px; align-items: flex-start; background: #f9fbff; margin-top: 0.6rem; }
.review-box input { margin-top: 2px; }
.review-text { font-size: 0.75rem; color: #33445f; }

.form-submit { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.submit-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.submit-check { font-size: 0.74rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.submit-check.ok { color: var(--ok); }
.submit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.list-box { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 0.8rem; overflow: hidden; }
.list-head { background: #eaf2ff; color: #113670; font-weight: 700; font-size: 0.82rem; padding: 0.7rem 0.9rem; }
.list-body { padding: 0.7rem 0.9rem; }
.list-row { font-size: 0.77rem; color: #2c3e59; padding: 5px 0; border-bottom: 1px solid #eef2f8; }
.list-row:last-child { border-bottom: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 37, 72, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
}
.modal-card {
  background: white;
  width: min(720px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1rem;
}
.modal-title { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 0.6rem; }
.modal-sub { color: var(--muted); font-size: 0.75rem; margin-bottom: 0.8rem; }
.terms-points { font-size: 0.77rem; color: #33445f; line-height: 1.55; display: grid; gap: 0.45rem; }
.modal-actions { margin-top: 1rem; display: flex; justify-content: flex-end; gap: 8px; }
.btn-outline { border: 1px solid var(--border); background: white; color: #344054; border-radius: 8px; padding: 0.62rem 0.85rem; cursor: pointer; font-weight: 600; }

.success-overlay { position: fixed; inset: 0; background: rgba(16, 37, 72, 0.7); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 1000; }
.success-card { background: white; width: min(460px, 100%); border-radius: 12px; padding: 1.3rem; border: 1px solid var(--border); text-align: center; }
.success-title { color: var(--navy); font-size: 1.2rem; font-weight: 800; margin-bottom: 0.4rem; }
.success-desc { color: var(--muted); font-size: 0.8rem; line-height: 1.5; margin-bottom: 0.8rem; }
.success-ref { background: #eef4ff; color: #15408a; border: 1px solid #d7e6ff; border-radius: 8px; padding: 0.5rem; font-size: 0.76rem; margin-bottom: 0.8rem; display: inline-block; }
.success-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.notif {
  position: fixed;
  top: 76px;
  right: 1rem;
  background: #102f60;
  color: white;
  font-size: 0.77rem;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid #8bb5ff;
  z-index: 1001;
  max-width: 320px;
}

@media (max-width: 1120px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 42vh; }
}
@media (max-width: 760px) {
  .fields-grid, .doc-grid, .submit-checks, .submit-actions, .success-actions, .info-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .hbadge { display: none; }
  .form-inner { padding: 1rem; }
}
