/* ════════════════════════════════════════════════════════
   Invoice Verifier — Professional Audit Design System
   ════════════════════════════════════════════════════════ */

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

/* ── Tokens ── */
:root {
  --bg:           #0d1117;
  --bg-surface:   #161b22;
  --bg-overlay:   #21262d;

  --accent:       #f0883e;
  --accent-dim:   rgba(240,136,62,0.12);
  --accent-glow:  rgba(240,136,62,0.25);

  --green:        #3fb950;
  --green-dim:    rgba(63,185,80,0.12);
  --green-glow:   rgba(63,185,80,0.25);
  --red:          #f85149;
  --red-dim:      rgba(248,81,73,0.12);
  --red-glow:     rgba(248,81,73,0.25);
  --amber:        #d29922;
  --amber-dim:    rgba(210,153,34,0.12);
  --amber-glow:   rgba(210,153,34,0.25);
  --blue:         #58a6ff;
  --blue-dim:     rgba(88,166,255,0.12);
  --blue-glow:    rgba(88,166,255,0.25);

  --border:       rgb(48,54,61);
  --border-muted: rgba(48,54,61,0.6);
  --border-hover: rgba(240,136,62,0.4);

  --text:         #e6edf3;
  --text-2:       #8b949e;
  --text-3:       #484f58;

  --radius-xs:    6px;
  --radius-sm:    10px;
  --radius:       14px;
  --radius-lg:    18px;

  --font:         'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════ */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 30px;
  height: 30px;
  background: var(--accent-dim);
  border: 1px solid rgba(240,136,62,0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.2px;
}

.header-sep {
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
}

.header-org {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.status-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

/* ════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════ */
.app-main {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  padding: 24px 24px 48px;
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 72px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Card ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Page load animations ── */
.sidebar { animation: fadeUp .5s ease both; }
.content { animation: fadeUp .5s .1s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════════
   UPLOAD CARD
   ════════════════════════════════════════════════════════ */
.drop-zone {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-overlay);
  margin-bottom: 14px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  border-style: solid;
}

.drop-icon {
  color: var(--text-3);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.drop-primary   { font-size: 14px; font-weight: 500; color: var(--text-2); }
.drop-secondary { font-size: 12px; color: var(--text-3); }

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  animation: fadeUp .2s ease;
}

.file-info-icon {
  width: 28px;
  height: 28px;
  background: var(--accent-dim);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.file-info-icon svg { width: 14px; height: 14px; }

.file-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  color: var(--text);
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-icon-sm svg { width: 13px; height: 13px; }
.btn-icon-sm:hover { background: var(--red-dim); color: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .18s, opacity .18s;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}

/* Ripple layer */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .15s;
}
.btn:active::after { opacity: 1; }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  width: 100%;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) {
  background: #e07c35;
}
.btn-primary:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--bg-overlay);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 7px 16px;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ════════════════════════════════════════════════════════
   PROGRESS CARD
   ════════════════════════════════════════════════════════ */
.progress-card { padding: 16px 20px; }

.progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.progress-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(240,136,62,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-id-label {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  flex-shrink: 0;
  white-space: nowrap;
}
.job-id-label:not(:empty)::before {
  content: '· ';
}

.progress-track {
  height: 6px;
  background: var(--bg-overlay);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}

.progress-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.progress-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ════════════════════════════════════════════════════════
   ACTIVITY LOG
   ════════════════════════════════════════════════════════ */
.log-card { min-height: 240px; }

.log-badge {
  background: var(--accent);
  color: #0d1117;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.activity-log {
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 4px;
}

.activity-log::-webkit-scrollbar { width: 4px; }
.activity-log::-webkit-scrollbar-track { background: transparent; }
.activity-log::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.15); border-radius: 4px; }

.log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 0;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.log-empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

/* ── Log Entry ── */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0 10px 12px;
  border-left: 2px solid var(--text-3);
  animation: logSlide .22s ease both;
}

@keyframes logSlide {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.log-entry + .log-entry { margin-top: 4px; }

/* Hide dot — replaced by border-left */
.log-dot { display: none; }

.log-body   { flex: 1; min-width: 0; }
.log-author { font-size: 11px; font-weight: 700; margin-bottom: 3px; letter-spacing: .2px; color: var(--text-3); }
.log-text   { font-size: 13px; color: var(--text-2); line-height: 1.55; word-break: break-word; }
.log-time   { font-size: 11px; color: var(--text-3); margin-top: 4px; font-family: var(--font-mono); }

/* Agent color themes — left border + author color */
.agent-coord  { border-left-color: var(--accent); }
.agent-flight { border-left-color: var(--blue); }
.agent-hotel  { border-left-color: var(--green); }
.agent-system { border-left-color: var(--text-3); }

.agent-coord  .log-author { color: var(--accent); }
.agent-flight .log-author { color: var(--blue); }
.agent-hotel  .log-author { color: var(--green); }
.agent-system .log-author { color: var(--text-3); }

/* ════════════════════════════════════════════════════════
   RESULT CARD
   ════════════════════════════════════════════════════════ */
.result-card { animation: fadeUp .3s ease; }

/* ── Verdict Banner ── */
.verdict-banner {
  border-top:    1px solid rgba(128,128,128,0.12);
  border-right:  1px solid rgba(128,128,128,0.12);
  border-bottom: 1px solid rgba(128,128,128,0.12);
  border-left:   4px solid currentColor;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  animation: verdictReveal .4s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes verdictReveal {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.verdict-autentik {
  background: var(--green-dim);
  border-top-color:    rgba(63,185,80,0.25);
  border-right-color:  rgba(63,185,80,0.25);
  border-bottom-color: rgba(63,185,80,0.25);
  color: var(--green);
}

.verdict-mencurigakan {
  background: var(--amber-dim);
  border-top-color:    rgba(210,153,34,0.25);
  border-right-color:  rgba(210,153,34,0.25);
  border-bottom-color: rgba(210,153,34,0.25);
  color: var(--amber);
}

.verdict-palsu {
  background: var(--red-dim);
  border-top-color:    rgba(248,81,73,0.25);
  border-right-color:  rgba(248,81,73,0.25);
  border-bottom-color: rgba(248,81,73,0.25);
  color: var(--red);
}

.verdict-unknown {
  background: var(--bg-overlay);
  border-top-color:    var(--border);
  border-right-color:  var(--border);
  border-bottom-color: var(--border);
  color: var(--text-2);
}

.verdict-left { display: flex; align-items: center; gap: 16px; }

.verdict-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 800;
  border: 1px solid currentColor;
  opacity: .9;
}
.verdict-autentik     .verdict-icon-wrap { background: var(--green-dim); }
.verdict-mencurigakan .verdict-icon-wrap { background: var(--amber-dim); }
.verdict-palsu        .verdict-icon-wrap { background: var(--red-dim); }
.verdict-unknown      .verdict-icon-wrap { background: var(--bg-overlay); }

.verdict-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .65;
  margin-bottom: 4px;
}

.verdict-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.2;
}

.verdict-desc {
  font-size: 13px;
  opacity: .7;
  margin-top: 5px;
  max-width: 340px;
  line-height: 1.5;
  color: var(--text-2);
}

.verdict-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.verdict-total {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
  font-family: var(--font-mono);
}

.verdict-meta {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.confidence-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.confidence-bar-bg {
  width: 90px;
  height: 4px;
  background: var(--bg-overlay);
  border-radius: 99px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
}

.confidence-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}

.verdict-autentik     .confidence-bar-fill { background: var(--green); }
.verdict-mencurigakan .confidence-bar-fill { background: var(--amber); }
.verdict-palsu        .confidence-bar-fill { background: var(--red); }
.verdict-unknown      .confidence-bar-fill { background: var(--text-3); }

.confidence-pct {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Manual review alert */
.manual-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--amber-dim);
  border: 1px solid rgba(210,153,34,0.25);
  color: var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  animation: fadeUp .25s ease;
}
.manual-alert svg { flex-shrink: 0; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 1px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  font-family: var(--font);
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--text-2); }

.tab-content { display: none; }
.tab-content.active {
  display: block;
  padding-top: 20px;
  animation: fadeUp .2s ease;
}

/* ── Field Grid ── */
.json-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.json-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.json-copy-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-hover);
  color: var(--text);
}

.json-copy-btn svg {
  flex-shrink: 0;
}

.json-viewer {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.json-viewer code {
  font-family: inherit;
}

.field-section { margin-bottom: 26px; }
.field-section:last-child { margin-bottom: 0; }

.field-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.field-section-title::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}

.field-item {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .18s;
}

.field-item:hover { border-color: var(--border-hover); }

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
}

.field-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
  font-family: var(--font-mono);
}

.field-value.empty {
  color: var(--text-3);
  font-style: italic;
  font-weight: 400;
  font-family: var(--font);
}

/* ── Evidence ── */
.evidence-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evidence-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(248,81,73,0.2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  line-height: 1.6;
}

.evidence-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--red);
}

/* ── Flags ── */
.flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flag-chip {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(210,153,34,0.2);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ── Suspicious indicator ── */
.suspicious-yes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--amber);
  font-weight: 700;
}

.suspicious-no {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-weight: 600;
}

/* ── Analysis notes ── */
.analysis-note {
  background: var(--accent-dim);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}

/* ── Addons table ── */
.addons-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.addon-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 7px 11px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.addon-label { color: var(--text-2); }
.addon-value { font-weight: 600; color: var(--text); font-family: var(--font-mono); }

/* ════════════════════════════════════════════════════════
   UTILITY
   ════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════
   SCROLLBAR GLOBAL
   ════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.3); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 940px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 14px;
  }
  .sidebar { position: static; }
}

@media (max-width: 560px) {
  .field-grid  { grid-template-columns: 1fr 1fr; }
  .verdict-banner { flex-direction: column; align-items: flex-start; }
  .verdict-right  { align-items: flex-start; }
  .tabs { overflow-x: auto; gap: 16px; flex-wrap: nowrap; }
  .app-header { padding: 0 16px; }
}
