.rail-caption {
  margin-top: auto;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  color: #dbe5ff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.direct-capture {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--brand-yellow);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

.direct-capture-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.direct-capture-heading h3 {
  margin: 5px 0 0;
  color: var(--brand-navy);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
}

.quantity-label {
  margin-bottom: 8px;
}

.quantity-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.quantity-field input {
  min-width: 0;
  height: 62px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-right: 0;
  font-size: 25px;
  font-weight: 800;
  color: var(--brand-navy);
}

.measure-suffix {
  min-width: 140px;
  padding: 0 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-navy);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.voice-button {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--brand-navy);
  color: var(--brand-navy);
  box-shadow: none;
}

.voice-button:hover,
.voice-button.recording {
  background: var(--brand-navy);
  color: #fff;
}

.voice-button.recording .voice-icon {
  color: #ff5a5f;
  animation: voice-pulse 1s infinite;
}

.voice-icon {
  color: #d71920;
  font-size: 14px;
}

.voice-status {
  min-height: 20px;
  margin: 10px 0 18px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.command-hint {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
}

.command-hint span {
  margin-right: 4px;
  color: var(--brand-navy);
  font-weight: 800;
}

.advance-button-group {
  display: grid;
  gap: 5px;
}

.phase-command-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 10.5px;
  text-align: center;
  white-space: nowrap;
}

.phase-command-hint span {
  margin-right: 3px;
  color: var(--brand-navy);
  font-weight: 800;
}

.direct-capture .command-hint {
  margin: -10px 0 14px;
}

.direct-capture .command-hint-centered {
  margin: 7px 0 0;
  text-align: center;
}

.voice-assistant {
  display: grid;
  gap: 10px;
}

.sidebar-voice-assistant {
  width: 100%;
  margin-top: auto;
  padding-top: 18px;
}

.assistant-toggle {
  width: 100%;
  min-width: 0;
  border-radius: var(--radius-md);
  background: var(--brand-yellow);
  color: var(--brand-navy-dark);
  box-shadow: 0 6px 18px rgba(255, 230, 0, 0.18);
}

.assistant-toggle:hover {
  background: #fff06a;
  color: var(--brand-navy-dark);
}

.assistant-toggle:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: #93a3c8;
  box-shadow: none;
  opacity: 1;
}

.assistant-toggle:disabled:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #93a3c8;
  transform: none;
}

.assistant-toggle.active {
  background: #0b7a3e;
  color: #fff;
}

.assistant-toggle.active .voice-icon {
  color: #fff;
  animation: voice-pulse 1s infinite;
}

.assistant-settings-link {
  width: max-content;
  justify-self: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #c8d3ee;
  box-shadow: none;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.assistant-settings-link:hover {
  background: transparent;
  color: #fff;
  box-shadow: none;
  transform: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.voice-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 20, 65, 0.58);
  backdrop-filter: blur(4px);
}

.voice-settings-dialog {
  width: min(820px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 20, 65, 0.28);
}

.history-detail-dialog {
  width: min(480px, 100%);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 20, 65, 0.28);
}

.history-detail-header {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 27px 28px 23px;
}

.history-detail-header h2 {
  margin: 5px 0 0;
  color: var(--brand-navy);
  font-size: 25px;
}

.history-detail-header p:last-child {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.history-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 17px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.count-confirmation-dialog {
  width: min(610px, 100%);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 20, 65, 0.28);
}

.count-confirmation-header {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 25px 28px 19px;
  border-bottom: 1px solid var(--border-light);
}

.count-confirmation-header h2 {
  margin: 5px 0 0;
  color: var(--brand-navy);
  font-size: 26px;
}

.count-confirmation-summary {
  display: grid;
  gap: 14px;
  padding: 22px 28px;
}

.count-confirmation-item,
.count-confirmation-values > div {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.count-confirmation-item {
  padding: 17px 18px;
  border-color: rgba(0, 40, 120, 0.22);
  background: #f7f9ff;
}

.count-confirmation-item strong {
  font-size: 20px;
}

.count-confirmation-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.count-confirmation-summary span,
.count-confirmation-summary small {
  color: var(--text-muted);
  font-size: 12px;
}

.count-confirmation-summary strong {
  color: var(--brand-navy);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.count-confirmation-warnings {
  margin: 0 28px 22px;
  padding: 17px 18px;
  border: 1px solid #f0c36a;
  border-radius: var(--radius-md);
  background: #fff9e8;
}

.count-confirmation-warnings.no-warnings {
  border-color: #b8dec9;
  background: #f1fbf5;
}

.count-confirmation-warnings h3 {
  margin: 0 0 9px;
  color: var(--brand-navy);
  font-size: 15px;
}

.count-confirmation-warnings ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: #7a4c00;
  font-size: 13px;
  line-height: 1.45;
}

.count-confirmation-warnings.no-warnings ul {
  padding-left: 0;
  color: #17643a;
  list-style: none;
}

.count-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 17px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.voice-settings-header {
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: flex-start;
  margin: 0;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
}

.voice-settings-header h2 {
  margin-top: 4px;
  font-size: 26px;
}

.voice-settings-header p:last-child {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.voice-settings-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--brand-navy);
  box-shadow: none;
  font-size: 24px;
}

.voice-command-settings {
  display: grid;
  gap: 16px;
  padding: 22px 26px;
}

.voice-command-card {
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

.voice-command-card h3 {
  margin: 0;
  color: var(--brand-navy);
  font-size: 17px;
}

.voice-command-card > p {
  margin: 5px 0 14px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.voice-phrase-row,
.voice-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 8px;
}

.voice-add-row {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 12px;
}

.voice-phrase-row input,
.voice-add-row input {
  padding: 10px 12px;
}

.voice-phrase-row input[readonly] {
  cursor: default;
  background: #f7f9fd;
  color: var(--text-secondary);
}

.voice-phrase-row-fixed input[readonly] {
  border-color: rgba(0, 40, 120, 0.24);
  background: #eef3ff;
  color: var(--brand-navy);
  font-weight: 700;
}

.voice-fixed-phrase:disabled {
  cursor: default;
  background: #dbe6ff;
  color: var(--brand-navy);
  opacity: 1;
}

.voice-phrase-row-fixed .voice-delete-phrase:disabled {
  cursor: not-allowed;
  border-color: var(--border-light);
  background: #f7f9fd;
  color: var(--text-muted);
  opacity: 1;
}

.voice-phrase-row button,
.voice-add-row button {
  padding: 9px 12px;
}

.voice-delete-phrase {
  background: #fff;
  border: 1px solid #e6a5a7;
  color: #a30f16;
  box-shadow: none;
}

.voice-empty-phrases {
  margin: 10px 0 0;
  color: #a30f16;
  font-size: 12px;
}

.voice-settings-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 26px;
  border-top: 1px solid var(--border-light);
  background: #fff;
}

@media (max-width: 620px) {
  .voice-settings-modal {
    padding: 10px;
  }

  .count-confirmation-summary {
    padding: 18px;
  }

  .count-confirmation-values {
    grid-template-columns: 1fr;
  }

  .count-confirmation-warnings {
    margin: 0 18px 18px;
  }

  .voice-phrase-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .voice-phrase-row input {
    grid-column: 1 / -1;
  }
}

.save-direct-count {
  width: 100%;
  background: var(--brand-navy);
}

.resolution-workspace {
  width: 100%;
}

.audit-workspace {
  width: 100%;
}

.resolution-card {
  padding: 24px;
}

.resolution-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.resolution-toolbar h3 {
  margin: 5px 0 0;
  color: var(--brand-navy);
  font-size: 22px;
}

.resolution-filter {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.resolution-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resolution-filter input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.resolution-progress {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.resolution-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.resolution-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.resolution-table th,
.resolution-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: middle;
}

.resolution-table th {
  background: var(--bg-subtle);
  color: var(--brand-navy);
  font-size: 12px;
  white-space: nowrap;
}

.resolution-table td {
  font-size: 13px;
}

.resolution-table tr:last-child td {
  border-bottom: 0;
}

.resolution-table tr.has-difference {
  background: #fffdf0;
}

.resolution-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.resolution-choice input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.resolution-difference {
  color: #a30f16;
  font-weight: 800;
}

.resolution-empty {
  padding: 28px !important;
  color: var(--text-muted);
  text-align: center !important;
}

.audit-meta {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.audit-filter {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.audit-filter select {
  width: auto;
  min-width: 170px;
  padding: 9px 12px;
}

.audit-table {
  min-width: 1080px;
}

.audit-tables-container {
  display: grid;
  gap: 26px;
}

.audit-unit-group {
  min-width: 0;
}

.audit-unit-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 3px 10px;
}

.audit-unit-heading h4 {
  margin: 4px 0 0;
  color: var(--brand-navy);
  font-size: 18px;
}

.audit-unit-heading > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.audit-table tfoot th,
.audit-table tfoot td {
  border-top: 2px solid var(--brand-navy);
  border-bottom: 0;
  background: var(--bg-subtle);
  color: var(--brand-navy);
  font-weight: 800;
}

.audit-table tfoot th {
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-observation {
  min-width: 220px;
  padding: 9px 10px;
}

.audit-missing {
  color: #a30f16;
  font-weight: 800;
}

.audit-surplus {
  color: #0b7a3e;
  font-weight: 800;
}

@keyframes voice-pulse {
  50% { opacity: 0.35; transform: scale(0.78); }
}

@media (max-width: 700px) {
  .direct-capture {
    padding: 18px;
  }

  .direct-capture-heading {
    align-items: flex-start;
  }

  .quantity-field {
    grid-template-columns: minmax(0, 1fr);
  }

  .quantity-field input {
    border-right: 1px solid var(--border-medium);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .measure-suffix {
    min-height: 46px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  .resolution-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .resolution-toolbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
