* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f4f5f7;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: #3457d5; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #1f2330;
  color: #fff;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.topbar h1 { margin: 0; font-size: 1.05rem; font-weight: 500; letter-spacing: 0.3px; }
.topbar nav a {
  color: #c9ccd6;
  margin-left: 1.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}
.topbar nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.06); }
.topbar nav a.active { color: #fff; background: rgba(255,255,255,0.12); }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h2 { font-size: 1.15rem; margin: 0 0 0.75rem; font-weight: 600; }
h4 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }

.upload-card,
.jobs-section {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.06);
  margin-bottom: 1.5rem;
}

.hint { color: #555; font-size: 0.9rem; margin: 0 0 1rem; }

.dropzone { display: flex; flex-direction: column; gap: 1rem; }

.drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  border: 2px dashed #b8bdc7;
  border-radius: 8px;
  background: #fafbfd;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 1rem;
}
.drop:hover { background: #eef2f7; border-color: #6781e0; }
.drop input { display: none; }
.drop-label {
  color: #555;
  font-size: 0.95rem;
  text-align: center;
  word-break: break-all;
  max-width: 100%;
}

.dropzone.has-file .drop {
  border-color: #2ecc71;
  background: #effaf3;
}
.dropzone.has-file .drop-label { color: #186432; font-weight: 500; }

button[type="submit"] {
  align-self: flex-start;
  padding: 0.55rem 1.4rem;
  background: #3457d5;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}
button[type="submit"]:hover { background: #2a47b8; }

.empty { color: #777; }

.jobs { display: flex; flex-direction: column; gap: 0.85rem; }

.job-card {
  background: #fcfcfd;
  border: 1px solid #e6e8ef;
  border-left: 4px solid #999;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}
.job-card.status-pending,
.job-card.status-uploading,
.job-card.status-parsing,
.job-card.status-extracting { border-left-color: #f5a623; }
.job-card.status-ready { border-left-color: #2ecc71; }
.job-card.status-pushed { border-left-color: #1f9d55; background: #f4faf6; }
.job-card.status-failed { border-left-color: #e74c3c; background: #fdf6f6; }

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.job-title strong { font-size: 1rem; display: block; }
.job-meta { font-size: 0.8rem; color: #888; }

.job-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.btn-delete {
  background: transparent;
  color: #b3252b;
  border: 1px solid #e0bcbf;
  border-radius: 5px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-delete:hover {
  background: #b3252b;
  color: #fff;
  border-color: #b3252b;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-head h2 { margin: 0; }

.btn-delete-all {
  background: #fff;
  color: #b3252b;
  border: 1px solid #e0bcbf;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-delete-all:hover {
  background: #b3252b;
  color: #fff;
  border-color: #b3252b;
}

.badge {
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #eee;
  color: #444;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-pending,
.badge-uploading,
.badge-parsing,
.badge-extracting { background: #fff3cd; color: #8a5c0f; }
.badge-ready { background: #d4edda; color: #186432; }
.badge-pushed { background: #c5e9d2; color: #0f5a29; }
.badge-failed { background: #f8d7da; color: #6f1f23; }

.error {
  background: #fde2e3;
  color: #6b1f22;
  padding: 0.55rem 0.8rem;
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  margin: 0.7rem 0 0;
}

.extracted { margin-top: 0.85rem; }
.extracted summary { cursor: pointer; color: #555; font-size: 0.9rem; }
.extracted dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.3rem;
  margin: 0.7rem 0 0;
}
.extracted dt { color: #777; font-size: 0.85rem; }
.extracted dd { margin: 0; font-weight: 500; }

.extracted code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: #eef0f4; padding: 0.05rem 0.35rem; border-radius: 3px; font-size: 0.85rem; }

.type {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  background: #eef1f8;
  color: #3457d5;
}
.type-invoice { background: #d6e7ff; color: #1d4fa3; }
.type-proforma { background: #fff0d6; color: #8c5500; }
.type-note { background: #ecdfff; color: #5b2ea3; }
.type-payment_demand { background: #ffd6d6; color: #8a1f1f; }
.type-other { background: #e9eaee; color: #555; }

.lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}
.lines th,
.lines td {
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid #ececec;
  text-align: left;
}
.lines th { background: #f5f6fa; font-weight: 500; color: #555; }
.lines td.num,
.lines th.num { text-align: right; font-variant-numeric: tabular-nums; }

.odoo-link {
  margin: 0.85rem 0 0;
  padding: 0.5rem 0.75rem;
  background: #eef7f1;
  border: 1px solid #cfe9d8;
  border-radius: 5px;
  font-size: 0.88rem;
}

.markdown-link {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #666;
}
.markdown-link a { color: #3457d5; }
