/* ======================= BASE ======================= */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e0e0e0;
  font-family: 'Segoe UI', Arial, sans-serif;
}

#logo-container {
  position: absolute;
  top: 0;
  width: 100vw;
  height: 168px;
  background: rgba(255,255,255,0.98);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 8px;
  box-sizing: border-box;
}

#logo-container img {
  width: min(94vw, 780px);
  max-width: 94vw;
  max-height: 136px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
  pointer-events: none;
}

#status {
  position: absolute;
  top: 172px;
  width: 100vw;
  text-align: center;
  padding: 4px 2px;
  background: #e8eaf6;
  font-weight: 500;
  font-size: 17px;
  z-index: 1201;
  border-bottom: 1px solid #d0d3e3;
  border-radius: 0 0 10px 10px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.25;
  min-height: calc(1em * 1.25);
}

.fab {
  position: absolute;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.19);
  font-size: 30px;
  border: none;
  outline: none;
  transition: background 0.2s, opacity 0.2s, transform 0.08s;
  cursor: pointer;
  color: #fff;
  opacity: 0.92;
}

.fabs-left .fab { left: calc(15px + env(safe-area-inset-left, 0px)); }
.fabs-right .fab { right: calc(15px + env(safe-area-inset-right, 0px)); }
#fabConfig { top: 302px; background: #7a7a7a; }
#fabDetails { top: 372px; background: #226aff; }
.fab:active { transform: translateY(1px); }
.fab[hidden] { display: none !important; }
.fab-disabled, .fab:disabled {
  opacity: 0.45 !important;
  cursor: default !important;
  pointer-events: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 2001;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  box-sizing: border-box;
  z-index: 2002;
  pointer-events: all;
  padding-left: 12px;
  padding-right: 12px;
}

.modal-content,
form.modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  width: calc(100vw - 24px);
  max-width: 720px;
  min-width: 0;
  text-align: left;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  box-sizing: border-box;
  margin: 0 auto;
}

.wide-modal {
  max-width: 800px;
}

.scrollable-modal {
  display: grid;
}

.modal-header,
.modal-body,
.modal-footer {
  width: 100%;
  box-sizing: border-box;
}

.modal-header {
  background: #fff;
  padding: 12px 14px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
}

.modal-body {
  overflow-y: auto;
  padding: 18px 18px 16px 18px;
  min-height: 0;
}

.modal-footer {
  background: #fff;
  padding: 10px 14px;
  text-align: right;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  flex: 0 0 auto;
}

.form-group {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.form-group input { min-height: 40px; }
.form-group textarea { min-height: 84px; resize: vertical; }
.form-group select { min-height: 40px; }
.form-group select option { font-size: 14px; padding: 6px 8px; line-height: 1.6; }
.form-group.inline { flex-direction: row; align-items: center; }
.form-group.inline label { margin: 0 8px 0 0; width: auto; }
.form-group.inline select { flex: 1; }

.btn-save {
  margin-top: 5px;
  padding: 8px 14px;
  background: #226aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.btn-save:hover { background: #1a55cc; }

.btn-secondary {
  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.12);
  color: #111;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
}
.btn-secondary:active { transform: scale(.99); }

#footer-app {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 10px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  background: #d6d6d6;
  border-top: 1px solid #bcbcbc;
  color: #333;
  z-index: 1500;
  white-space: normal;
  overflow-wrap: anywhere;
}

#main {
  padding: 280px 16px 110px;
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
}
body.fabs-right #main { padding-right: calc(16px + 72px); }
body.fabs-left #main { padding-left: calc(16px + 72px); }

.card {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}

.row { display: flex; align-items: center; }
.radio-row { display:flex; gap:8px; align-items:center; margin:6px 0; font-size:15px; }
.mode-section-title { font-weight: 600; margin-bottom: 8px; }
.action-stack { display:flex; flex-direction:column; gap:12px; }
.status-action {
  margin-left: 8px;
  border: none;
  background: #226aff;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .modal-content, form.modal-content { max-width: none; }
}


.entry-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.entry-session-card {
  background: rgba(255,255,255,.96);
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0,0,0,.12);
}

.entry-session-kicker {
  font-size: 14px;
  color: rgba(0,0,0,.72);
  margin-bottom: 4px;
}

.entry-session-line {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.entry-switch-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.entry-switch-row .entry-switch-btn {
  margin-top: 0;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 12px;
}

.entry-shell-sep {
  display: none;
}

.chip-entry-form {
  display: flex;
  flex-direction: column;
}

.scan-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan-wrap video {
  width: 100%;
  max-height: 56vh;
  border-radius: 14px;
  background: #000;
  object-fit: cover;
}

.scan-help {
  font-size: 14px;
  color: rgba(0,0,0,.7);
}

