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

body {
  font-family: system-ui, sans-serif;
  background: #f5f0ea;
  color: #1c1b1f;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── toolbar ── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #d4c5b2;
  flex-shrink: 0;
}
#toolbar h1 { font-size: 18px; font-weight: 700; }

/* ── upload bar ── */
#upload-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: #ece7e0;
  border-bottom: 1px solid #c4b9ad;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#drop-hint {
  font-size: 13px;
  color: #8b7d6b;
}
#upload-status {
  font-size: 13px;
  color: #5a4e42;
  margin-left: auto;
}

.btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn-primary { background: #8b7d6b; color: #fff; }
.btn-primary:hover { background: #7a6c5c; }

/* ── calls list ── */
#calls-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#calls-empty {
  text-align: center;
  color: #9e8e7a;
  margin-top: 60px;
  font-size: 15px;
  line-height: 1.7;
}

/* ── call entry ── */
.call-entry {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #c4b9ad;
  overflow: hidden;
}

.call-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #ece7e0;
  border-bottom: 1px solid #c4b9ad;
  font-size: 13px;
  font-weight: 600;
}
.call-num {
  color: #8b7d6b;
  font-size: 11px;
  font-weight: 400;
}
.call-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
}
.call-status.processing { background: #fff3cd; color: #856404; }
.call-status.done       { background: #d1edda; color: #155724; }
.call-status.error      { background: #f8d7da; color: #842029; }

.call-timing {
  display: flex;
  gap: 24px;
  padding: 8px 14px;
  border-bottom: 1px solid #ece7e0;
  font-size: 12px;
  flex-wrap: wrap;
  background: #faf9f7;
}
.timing-item { display: flex; flex-direction: column; gap: 2px; }
.timing-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #8b7d6b; }
.timing-value { font-family: monospace; color: #1c1b1f; font-weight: 600; }
.timing-value.duration { color: #1e64ff; }

.call-details {
  display: flex;
  gap: 16px;
  padding: 6px 14px;
  border-bottom: 1px solid #ece7e0;
  font-size: 12px;
  color: #5a4e42;
  background: #faf9f7;
  flex-wrap: wrap;
}
.call-details span { white-space: nowrap; }
.call-details strong { color: #1c1b1f; }

.call-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 600px) {
  .call-images { grid-template-columns: 1fr; }
}

.img-col {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.img-col:first-child {
  border-right: 1px solid #ece7e0;
}

.img-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8b7d6b;
}

.img-col img, .img-col canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid #c4b9ad;
}

.img-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: #f0ece6;
  border-radius: 4px;
  border: 1px dashed #c4b9ad;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9e8e7a;
  font-size: 12px;
}

.call-error {
  padding: 10px 14px;
  color: #842029;
  font-size: 13px;
  background: #fff8f8;
}

/* ── legend ── */
.call-legend {
  display: flex;
  gap: 10px;
  padding: 6px 14px 10px;
  font-size: 11px;
  flex-wrap: wrap;
  border-top: 1px solid #ece7e0;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-swatch {
  width: 12px; height: 12px;
  border-radius: 2px;
  border: 2px solid;
  flex-shrink: 0;
}

/* ── drop overlay ── */
#drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(139,125,107,.35);
  border: 4px dashed #8b7d6b;
  z-index: 100;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  pointer-events: none;
}
#drop-overlay.visible { display: flex; }

/* spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid #8b7d6b;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
