/* KSE Q&A Analyzer — site chrome styles (tokens per docs/UI_SPEC.md) */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}
body {
  background: #f4f6f9;
  color: #1a1f2b;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: #0e7d97; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, #ffffff, #eef2f8);
  border-bottom: 1px solid #e3e7ee;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #121620;
  letter-spacing: .01em;
}
.brand .sub {
  margin-top: 2px;
  font-size: 13px;
  color: #5b6472;
}
.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.user-email {
  font-size: 13px;
  color: #475467;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.panel {
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
  color: #121620;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: #eaf1ff;
  color: #2453c9;
  border: 1px solid #cdd9f5;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #dbe7ff; text-decoration: none; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: #2f62e6; color: #ffffff; border-color: #2f62e6; }
.btn-primary:hover { background: #2453c9; }
.btn-danger { background: #fce8ea; color: #c0293a; border-color: #f2c7cd; }
.btn-danger:hover { background: #f8d6da; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-start { display: block; width: 100%; margin-top: 14px; padding: 12px; font-size: 15px; }
.btn-start:disabled:hover { background: #2f62e6; }

/* ---------- Tags / badges / stats (reusable) ---------- */
.tag {
  display: inline-block;
  background: #eef1f6;
  color: #5b6472;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 20px;
  padding: 3px 9px;
}
.tag.th { background: #e5f2f6; color: #0e7d97; }
.badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}
.stat {
  background: #f7f9fc;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
  padding: 10px 14px;
}
.stat .stat-value { font-size: 20px; font-weight: 700; color: #121620; }
.stat .stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #475467;
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  padding: 4px 13px;
  white-space: nowrap;
}
.pill.uploading { background: #eef1f6; color: #5b6472; }
.pill.uploaded  { background: #faf1dd; color: #9a6206; }
.pill.queued    { background: #eef1f6; color: #5b6472; }
.pill.processing { background: #eaf1ff; color: #2453c9; }
.pill.done      { background: #e7f6ee; color: #12905a; }
.pill.error     { background: #fce8ea; color: #c0293a; }
.pill.expired   { background: #eef1f6; color: #8a94a6; }

/* ---------- Expiry badge ---------- */
.badge-expiry {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 10px;
  background: #faf1dd;
  color: #b9740a;
  white-space: nowrap;
}
.badge-expiry.soon { background: #fce8ea; color: #c0293a; }
.badge-expiry:empty { display: none; }

/* ---------- Upload panel ---------- */
.dropzone {
  border: 2px dashed #d3d9e3;
  border-radius: 14px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  background: #f0f3f7;
  transition: border-color .15s, background .15s;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: #2f62e6;
  background: #eaf1ff;
}
.dropzone.disabled { opacity: .55; cursor: default; }
.dz-icon { font-size: 26px; color: #2f62e6; line-height: 1; }
.dz-text { margin-top: 10px; font-size: 15px; color: #121620; }
.dz-hint { margin-top: 5px; font-size: 12px; color: #8a94a6; }
.dz-file { margin-top: 8px; font-size: 13px; color: #0e7d97; word-break: break-all; }
.dz-file:empty { display: none; }

.upload-row { margin-top: 12px; }
.text-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  color: #1a1f2b;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
}
.text-input:focus { outline: none; border-color: #2f62e6; }
.text-input::placeholder { color: #8a94a6; }

.upload-error {
  margin-top: 12px;
  background: #fce8ea;
  border: 1px solid #f2c7cd;
  color: #c0293a;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
}

/* ---------- Upload progress ---------- */
.progress { margin-top: 14px; }
.progress-track {
  height: 8px;
  background: #e3e7ee;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f62e6, #5b9bd5);
  border-radius: 4px;
  transition: width .2s;
}
.progress-label { margin-top: 6px; font-size: 12px; color: #5b6472; }

/* ---------- Confirm modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 45, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-sheet {
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.modal-sheet h2 { margin: 0 0 12px; font-size: 18px; color: #121620; }
.warn-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: #475467;
  font-size: 13px;
}
.warn-list li { margin-bottom: 6px; }
.modal-file {
  background: #f0f3f7;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #0e7d97;
  margin-bottom: 16px;
  word-break: break-all;
}
.modal-file:empty { display: none; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- History / event cards ---------- */
.history-section { margin-top: 26px; }
.history-title { font-size: 15px; color: #121620; margin: 0 0 12px; }
.empty-state {
  background: #ffffff;
  border: 1px dashed #d3d9e3;
  border-radius: 14px;
  padding: 34px 20px;
  text-align: center;
  color: #5b6472;
  font-size: 14px;
}
.ecard {
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color .15s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.ecard:hover { border-color: #2f62e6; }
.ecard.expired { opacity: .6; }
.ecard.expired:hover { border-color: #e3e7ee; }
.ecard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ecard-title {
  font-size: 16px;
  font-weight: 600;
  color: #121620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ecard-meta { margin-top: 3px; font-size: 12px; color: #5b6472; }
.ecard-error {
  margin-top: 10px;
  font-size: 13px;
  color: #c0293a;
  background: #fce8ea;
  border-radius: 8px;
  padding: 8px 12px;
}
.ecard-muted { margin-top: 10px; font-size: 13px; color: #8a94a6; }
.ecard-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ecard-stats { margin-top: 8px; font-size: 13px; color: #475467; }

/* ---------- Stage progress (single continuous bar) ---------- */
.progress-wrap { margin-top: 12px; }
.progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.overall-pct { font-size: 22px; font-weight: 700; color: #121620; flex-shrink: 0; }
.stage-label { font-size: 15px; font-weight: 600; color: #1a1f2b; }
.bigbar-track {
  height: 12px;
  background: #e3e7ee;
  border-radius: 6px;
  overflow: hidden;
}
.bigbar-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2f62e6, #5b9bd5);
  background-size: 200% 100%;
  animation: barflow 2s linear infinite;
  transition: width .35s ease;
}
@keyframes barflow {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.stage-sub { margin-top: 7px; font-size: 13px; color: #5b6472; }
.stage-note { margin-top: 3px; font-size: 11px; color: #8a94a6; }

/* ---------- Login (minimal) ---------- */
.login-wrap {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box { width: 100%; max-width: 380px; text-align: center; }
.btn-google-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 22px;
  font-size: 16px;
  font-weight: 600;
  background: #ffffff;
  color: #1a1f2b;
  border: 1px solid #d3d9e3;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.btn-google-big:hover {
  background: #f7f9fc;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .1);
  text-decoration: none;
}
.g-logo { flex-shrink: 0; }
.login-note { margin-top: 18px; font-size: 12px; color: #8a94a6; }
.banner-muted {
  background: #eef1f6;
  border: 1px solid #d3d9e3;
  color: #5b6472;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ---------- Event page top bar ---------- */
body.event-page { overflow: hidden; }
.topbar {
  height: 44px;
  background: #ffffff;
  border-bottom: 1px solid #e3e7ee;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
}
.topbar-back {
  color: #0e7d97;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.topbar-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #121620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.report-frame { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ecard-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .topbar { height: auto; min-height: 44px; flex-wrap: wrap; padding: 6px 10px; }
  .report-frame { height: calc(100vh - 88px) !important; }
  body.event-page { overflow: auto; }
}
