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

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3347;
  --accent: #6c63ff;
  --accent2: #4ecca3;
  --text: #e8eaf0;
  --text2: #8b90a8;
  --danger: #e05252;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; }
.container { max-width: 960px; margin: 0 auto; padding: 0 1.5rem 3rem; }

/* Header */
.header { border-bottom: 1px solid var(--border); padding: 1rem 0; margin-bottom: 2rem; }
.header .container { display: flex; align-items: center; gap: 1rem; padding-bottom: 0; }
.header__brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.15rem; }
.header__icon { font-size: 1.3rem; }
.header__sub { color: var(--text2); font-size: 0.88rem; margin-left: auto; }

/* Card */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem; }

/* Upload Zone */
.upload-zone { text-align: center; }
.upload-zone__inner { padding: 2.5rem 1rem; border: 2px dashed var(--border); border-radius: 10px; transition: border-color 0.2s, background 0.2s; }
.upload-zone__inner.drag-over { border-color: var(--accent); background: rgba(108,99,255,0.06); }
.upload-zone__icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.6; }
.upload-zone__title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.3rem; }
.upload-zone__sub { color: var(--text2); font-size: 0.85rem; margin-bottom: 1.25rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.25rem; border-radius: 8px; border: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #7c74ff; }
.btn--outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn--outline:hover { background: var(--accent); color: #fff; }
.btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--text2); }
.btn--ghost:hover { border-color: var(--text2); color: var(--text); }
.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn--xs { padding: 0.25rem 0.65rem; font-size: 0.78rem; }

/* Processing */
.processing { display: flex; align-items: center; gap: 1rem; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.processing__spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing__title { font-weight: 600; margin-bottom: 0.15rem; }
.processing__sub { color: var(--text2); font-size: 0.85rem; }

/* Result */
.result { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem; }
.result__header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.result__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.result__filename { color: var(--text2); font-size: 0.85rem; margin-left: 0.5rem; }
.result__summary { color: var(--text2); font-size: 0.9rem; margin-bottom: 1.5rem; font-style: italic; }
.result__body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 640px) { .result__body { grid-template-columns: 1fr; } }

/* Badge */
.badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 20px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(108,99,255,0.2); color: var(--accent); }
.badge--invoice { background: rgba(78,204,163,0.15); color: var(--accent2); }
.badge--receipt { background: rgba(245,197,24,0.15); color: #f5c518; }
.badge--contract { background: rgba(224,82,82,0.15); color: var(--danger); }
.badge--resume { background: rgba(108,99,255,0.2); color: var(--accent); }

/* Panels */
.panel__title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); margin-bottom: 0.85rem; }
.panel__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.fields-panel, .raw-panel { background: var(--bg3); border-radius: 8px; padding: 1rem; }

/* Fields Grid */
.fields-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.field-item { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.5rem 0.6rem; background: var(--bg2); border-radius: 6px; border-left: 3px solid var(--accent); }
.field-item__key { font-size: 0.72rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.field-item__val { font-size: 0.88rem; color: var(--text); word-break: break-word; }

/* Raw Text */
.raw-text { font-size: 0.78rem; color: var(--text2); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; line-height: 1.6; padding: 0.5rem; background: var(--bg2); border-radius: 6px; }

/* History */
.history { }
.history__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.history__list { display: flex; flex-direction: column; gap: 0.5rem; }
.history-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.85rem; background: var(--bg3); border-radius: 8px; cursor: pointer; transition: background 0.15s; border: 1px solid transparent; }
.history-item:hover { background: var(--bg); border-color: var(--border); }
.history-item__name { flex: 1; font-size: 0.88rem; font-weight: 500; }
.history-item__meta { font-size: 0.78rem; color: var(--text2); }
.history-item__status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status--done { background: var(--accent2); }
.status--processing { background: var(--accent); animation: pulse 1s infinite; }
.status--error { background: var(--danger); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.empty { color: var(--text2); font-size: 0.88rem; text-align: center; padding: 1rem 0; }
[hidden] { display: none !important; }
