:root {
  --blue-900: #0F2B4C;
  --blue-700: #1E4D7B;
  --blue-500: #4A90E2;
  --blue-300: #7FB8F0;
  --cyan-400: #5EC5E8;
  --ice-100: #EAF4FC;
  --ice-50:  #F5FAFE;
  --text-dark: #14304D;
  --text-mid: #4A6B8A;
  --shadow: 0 10px 30px rgba(30, 77, 123, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--ice-50) 0%, var(--ice-100) 60%, #DCEBF9 100%);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- HEADER ---------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: linear-gradient(90deg, var(--blue-900), var(--blue-700));
  color: white;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 52px; height: 52px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.header h1 { font-size: 1.4rem; letter-spacing: 0.3px; }
.header h1 .dot { color: var(--cyan-400); }
.slogan { font-size: 0.85rem; opacity: 0.85; margin-top: 2px; }
.privacy-badge {
  background: rgba(94, 197, 232, 0.18);
  border: 1px solid var(--cyan-400);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- MAIN ---------- */
.container { max-width: 900px; width: 100%; margin: 0 auto; padding: 40px 20px; flex: 1; }

.hero { text-align: center; margin-bottom: 32px; }
.hero h2 {
  font-size: 2rem;
  background: linear-gradient(90deg, var(--blue-700), var(--cyan-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}
.hero p { color: var(--text-mid); max-width: 640px; margin: 0 auto; line-height: 1.6; }

/* ---------- UPLOAD ---------- */
.upload-section { margin-bottom: 30px; }
.drop-zone {
  display: block;
  background: white;
  border: 2.5px dashed var(--blue-300);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .25s ease;
  color: var(--blue-700);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--cyan-400);
  background: var(--ice-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.drop-inner svg { color: var(--blue-500); margin-bottom: 12px; }
.drop-inner p { color: var(--text-dark); margin-bottom: 6px; }
.drop-inner small { color: var(--text-mid); }

.status {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px; padding: 14px 20px;
  background: white; border-radius: 12px; box-shadow: var(--shadow);
  color: var(--blue-700); font-weight: 500;
}
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--ice-100);
  border-top-color: var(--cyan-400); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress { margin-top: 12px; height: 8px; background: var(--ice-100); border-radius: 8px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue-500), var(--cyan-400)); transition: width .3s ease; }

/* ---------- RESULTS ---------- */
.results { display: grid; gap: 22px; }
.card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--blue-500);
}
.card h3 { color: var(--blue-700); font-size: 1.05rem; margin-bottom: 12px; }
.ocr-text {
  background: var(--ice-50);
  padding: 14px;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--text-mid);
  outline: none;
}
.summary { line-height: 1.7; color: var(--text-dark); font-size: 1rem; }
.summary .loading { color: var(--text-mid); font-style: italic; }

.key-data { list-style: none; display: grid; gap: 10px; }
.key-data li {
  padding: 10px 14px;
  background: var(--ice-50);
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text-dark);
}
.key-data li strong { color: var(--blue-700); }

/* ---------- CHAT ---------- */
.chat-card { border-left-color: var(--cyan-400); }
.chat-log {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 300px; overflow-y: auto;
  margin-bottom: 14px; padding: 8px;
}
.chat-msg { padding: 10px 14px; border-radius: 12px; max-width: 85%; font-size: 0.92rem; line-height: 1.5; }
.chat-msg.user { align-self: flex-end; background: var(--blue-500); color: white; border-bottom-right-radius: 4px; }
.chat-msg.bot  { align-self: flex-start; background: var(--ice-100); color: var(--text-dark); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 10px; }
.chat-form input {
  flex: 1; padding: 12px 16px; border-radius: 10px;
  border: 2px solid var(--ice-100); font-size: 0.95rem;
  outline: none; transition: border-color .2s;
}
.chat-form input:focus { border-color: var(--cyan-400); }
.chat-form button {
  padding: 12px 22px; border: none; border-radius: 10px;
  background: linear-gradient(90deg, var(--blue-500), var(--cyan-400));
  color: white; font-weight: 600; cursor: pointer;
  transition: transform .15s ease;
}
.chat-form button:hover { transform: translateY(-1px); }
.chat-form button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- FOOTER ---------- */
.footer {
  text-align: center; padding: 24px;
  color: var(--text-mid); font-size: 0.82rem;
  border-top: 1px solid rgba(74, 144, 226, 0.15);
}

@media (max-width: 640px) {
  .header { flex-direction: column; gap: 12px; padding: 16px; }
  .hero h2 { font-size: 1.5rem; }
  .container { padding: 24px 14px; }
}