.scanner-view {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
}

.scanner-content {
  padding: 2rem var(--margin-main) 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInUp 0.5s ease-out;
}

.scanner-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.scanner-icon-circle {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--radius-full);
  background: var(--tertiary-container);
  color: var(--on-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.scanner-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.2;
}

.scanner-desc {
  font-size: 1rem;
  color: var(--on-surface-variant);
  font-weight: 400;
  max-width: 22rem;
  line-height: 1.5;
}

.scan-error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--error-container);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.scan-error-icon {
  color: var(--error);
  width: 2.5rem;
  height: 2.5rem;
}

.scan-error-text {
  color: var(--on-error-container);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.scan-btn {
  height: var(--touch-target-min);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.15s, transform 0.1s;
}

.scan-btn:active {
  transform: scale(0.97);
}

.scan-btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.scan-btn--outline {
  background: transparent;
  border: 2px solid var(--error);
  color: var(--on-error-container);
}

.scan-btn--ghost {
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  width: 100%;
}

.scan-btn--start {
  width: 100%;
  padding: 0 1.5rem;
  height: 3.75rem;
  font-size: 1.125rem;
}

.scanner-camera-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 10% 12%;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--tertiary-container);
  border-style: solid;
  border-width: 0;
}

.corner.tl { top: 0; left: 0;  border-top-width: 3px;    border-left-width: 3px;  border-radius: 4px 0 0 0; }
.corner.tr { top: 0; right: 0; border-top-width: 3px;    border-right-width: 3px; border-radius: 0 4px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-bottom-width: 3px; border-left-width: 3px;  border-radius: 0 0 0 4px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }

.scanner-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.scanning-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

.scanning-active p {
  color: var(--on-surface-variant);
  font-size: 0.95rem;
  margin: 0;
}

.scanner-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.cip-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cip-label {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.cip-row {
  display: flex;
  gap: 0.5rem;
}

.cip-input {
  flex: 1;
  background: var(--surface-container-lowest);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  color: var(--on-surface);
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.15s;
}

.cip-input::placeholder {
  color: var(--on-surface-variant);
  letter-spacing: 0.04em;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  opacity: 0.6;
}

.cip-input:focus {
  border-color: var(--primary);
}

/* Prescriptions panel */
.prescriptions-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cip-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 69, 13, 0.08);
  border: 1px solid rgba(0, 69, 13, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--primary);
}

.cip-badge-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}

.cip-badge-value {
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  color: var(--on-surface-variant);
  margin: 0.1rem 0 0;
}

.rx-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-surface);
  margin: 0;
}

.rx-subtitle {
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  margin: -0.75rem 0 0;
}

.rx-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 0;
  color: var(--on-surface-variant);
  font-size: 0.9rem;
}

.rx-empty {
  color: var(--on-surface-variant);
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

.rx-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.rx-item:hover {
  background: var(--surface-container);
  border-color: var(--primary);
}

.rx-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rx-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface);
}

.rx-detail {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

.rx-ingredient {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
}

.rx-arrow {
  color: var(--primary);
  flex-shrink: 0;
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Photo upload section */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upload-label {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.upload-row {
  display: flex;
  gap: 0.75rem;
}

.upload-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  background: var(--surface-container-lowest);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--on-surface);
  transition: border-color 0.15s, background 0.15s;
}

.upload-option:hover {
  border-color: var(--primary);
  background: var(--surface-container);
}

.upload-option:active {
  transform: scale(0.97);
}

.upload-option svg {
  color: var(--primary);
}

.upload-hidden-input {
  display: none;
}

/* Photo preview */
.photo-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-preview-container {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  max-height: 22rem;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-height: 22rem;
}

.photo-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
