/* BoundaryCheck V1.1 — accessibility: dark text on white, min #555 for secondary */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, Segoe UI, Arial, sans-serif; color: #222; background: #fff; }
body { min-height: 100vh; }
a { color: #0a58ca; }
a:visited { color: #0a58ca; }

header.topbar {
  background: #0d3b66; color: #fff; padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
header.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; }
header.topbar .user { font-size: 14px; }
header.topbar button {
  background: #fff; color: #0d3b66; border: 0; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-weight: 600;
}

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* Login page */
.auth-wrap { max-width: 420px; margin: 80px auto; padding: 32px; border: 1px solid #ccc; border-radius: 8px; }
.auth-wrap h2 { margin-top: 0; color: #0d3b66; }
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid #ddd; }
.auth-tabs button {
  flex: 1; padding: 10px; background: none; border: 0; cursor: pointer; font-size: 15px; color: #555; font-weight: 500;
}
.auth-tabs button.active { color: #0d3b66; border-bottom: 3px solid #0d3b66; }
form.auth-form label { display: block; margin-top: 14px; font-size: 14px; color: #333; font-weight: 500; }
form.auth-form input { width: 100%; padding: 10px; font-size: 15px; border: 1px solid #999; border-radius: 4px; margin-top: 4px; }
form.auth-form button[type="submit"] {
  width: 100%; margin-top: 20px; padding: 12px; background: #0d3b66; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.msg { margin-top: 14px; padding: 10px; border-radius: 4px; font-size: 14px; }
.msg.error { background: #fde2e2; color: #8b1a1a; border: 1px solid #e5a0a0; }
.msg.ok { background: #d4edda; color: #155724; border: 1px solid #a3cfb5; }
.hidden { display: none; }

/* Dashboard */
.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.stage-card {
  background: #f4f6f8; border: 1px solid #ccc; border-radius: 6px; padding: 14px; text-align: center;
}
.stage-card .count { font-size: 28px; font-weight: 700; color: #0d3b66; }
.stage-card .label { font-size: 13px; color: #555; margin-top: 4px; }

.add-row { background: #f8f9fa; padding: 16px; border: 1px solid #ccc; border-radius: 6px; margin-bottom: 16px; }
.add-row h3 { margin: 0 0 10px 0; color: #0d3b66; font-size: 16px; }
.add-row form { display: grid; grid-template-columns: 2fr 1fr 1fr 120px 120px; gap: 8px; align-items: end; }
.add-row label { font-size: 13px; color: #333; font-weight: 500; }
.add-row input { width: 100%; padding: 8px; font-size: 14px; border: 1px solid #999; border-radius: 4px; }
.add-row button {
  padding: 9px; background: #0d3b66; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-weight: 600;
}

table.props { width: 100%; border-collapse: collapse; background: #fff; }
table.props th, table.props td { border: 1px solid #ccc; padding: 10px; text-align: left; font-size: 14px; color: #222; }
table.props th { background: #0d3b66; color: #fff; font-weight: 600; }
table.props tr:nth-child(even) td { background: #f8f9fa; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-badge.pending { background: #fff3cd; color: #664d03; }
.status-badge.ready { background: #d4edda; color: #155724; }
table.props button.row-action {
  padding: 6px 10px; background: #fff; color: #8b1a1a; border: 1px solid #8b1a1a; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.empty-row td { text-align: center; color: #555; padding: 30px; }

/* Step button states — gray idle, yellow running, green done, red error */
.step-btn {
  padding: 6px 10px; font-size: 12px; font-weight: 700; border-radius: 4px; cursor: pointer;
  border: 1px solid #666; background: #f0f0f0; color: #333; min-width: 70px;
}
.step-btn:hover:not(:disabled) { background: #e4e4e4; }
.step-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.step-btn.running { background: #fff3cd; color: #664d03; border-color: #856404; }
.step-btn.done { background: #1e7e34; color: #fff; border-color: #155724; }
.step-btn.err { background: #c82333; color: #fff; border-color: #8b1a1a; }

.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 6px 10px; font-size: 12px; font-weight: 600; border-radius: 4px; cursor: pointer; border: 1px solid #0d3b66; background: #fff; color: #0d3b66; }
.row-actions button:hover { background: #e8eef5; }
.row-actions button.danger { border-color: #8b1a1a; color: #8b1a1a; }
.row-actions button.danger:hover { background: #fde2e2; }

/* Detail row (expanded) */
tr.detail-row td { background: #f4f6f8; padding: 18px; border-top: none; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.detail-grid .kv { background: #fff; padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px; }
.detail-grid .kv .k { font-size: 11px; text-transform: uppercase; color: #555; font-weight: 600; letter-spacing: 0.5px; }
.detail-grid .kv .v { font-size: 14px; color: #222; margin-top: 3px; word-break: break-word; }
.detail-section { margin-top: 16px; }
.detail-section h4 { margin: 0 0 8px 0; color: #0d3b66; font-size: 14px; }
.type-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pill { background: #0d3b66; color: #fff; padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.clerk-list { max-height: 360px; overflow-y: auto; border: 1px solid #ccc; background: #fff; border-radius: 4px; }
.clerk-list table { width: 100%; border-collapse: collapse; }
.clerk-list th, .clerk-list td { padding: 6px 10px; border-bottom: 1px solid #e5e5e5; font-size: 13px; color: #222; text-align: left; }
.clerk-list th { background: #0d3b66; color: #fff; position: sticky; top: 0; font-weight: 600; }
.clerk-list tr:nth-child(even) td { background: #f8f9fa; }
.small-error { color: #8b1a1a; font-size: 13px; margin-top: 6px; }

/* ═══════ Floating stats widget (top-right) ═══════ */
#stats-widget {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 900;
  background: #fff;
  border: 1px solid #0d3b66;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-width: 150px;
}
#stats-widget .stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}
#stats-widget .stats-label {
  color: #333;
  font-weight: 600;
}
#stats-widget .stats-val {
  color: #0d3b66;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#stats-widget .stats-colors {
  border-top: 1px solid #e4e4e4;
  margin-top: 4px;
  padding-top: 6px;
  justify-content: space-around;
  gap: 6px;
}
#stats-widget .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}
#stats-widget .dot-green { background: #1e7e34; }
#stats-widget .dot-yellow { background: #f0ad4e; }
#stats-widget .dot-red { background: #c82333; }
#stats-widget .stats-colors .stats-val {
  margin-right: 4px;
  font-size: 13px;
}
