* {
  box-sizing: border-box;
}

:root {
  --blue-dark: #203a7a;
  --blue-mid: #1f4fa3;
  --blue-soft: #e8f0ff;
  --blue-soft-strong: #d9e5ff;
  --text-ink: #12345a;
  --card-border: #d9e4f2;
  --surface: #fff;
  color: var(--text-ink);
  background: var(--surface);
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 110px;
  padding: 18px max(24px, calc((100vw - 1424px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 4px 16px rgba(18, 52, 90, 0.06);
}

.page-header h1,
.page-header p,
.section-heading h2,
.section-heading p {
  margin: 0;
}

.page-header h1 {
  color: var(--blue-dark);
  font-size: clamp(22px, 3vw, 32px);
}

.page-header p,
.section-heading p {
  margin-top: 5px;
  color: #58708d;
  font-size: 14px;
}

#connectionStatus {
  margin-top: 4px;
  color: #58708d;
  font-size: 12px;
}

#connectionStatus.error {
  color: #b42318;
}

.location-picker {
  display: grid;
  gap: 6px;
  min-width: 190px;
  margin-left: auto;
  color: var(--text-ink);
  font-size: 13px;
  font-weight: 700;
}

.location-picker select {
  min-height: 42px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #c8d8eb;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-ink);
  font: inherit;
}

.location-picker select:focus,
.seat-card input:focus {
  outline: 2px solid rgba(77, 124, 255, 0.5);
  outline-offset: 1px;
}

main {
  padding: 28px 24px 48px;
}

.seat-manager-card {
  width: 100%;
  max-width: 1424px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid #d9e4f2;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(18, 52, 90, 0.07);
}

html.embedded body {
  background: #fff;
}

html.embedded main {
  padding-top: 20px;
}

html.embedded .page-header {
  justify-content: flex-start;
  padding-right: 24px;
  padding-left: 24px;
}

html.embedded .seat-manager-card {
  max-width: 1600px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2 {
  color: var(--blue-dark);
  font-size: 21px;
}

.seat-manager-inputs-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  align-items: start;
  gap: 20px;
}

.seat-manager-extra-field {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
}

.seat-manager-extra-field textarea {
  width: 100%;
  min-height: 96px;
  padding: 8px 10px;
  border: 1px solid #c5d1df;
  border-radius: 6px;
  color: #12345a;
  font: inherit;
  resize: vertical;
}

.seat-manager-parser-status {
  min-height: 1em;
  margin: 0;
  color: #0f6b4d;
  font-size: 12px;
  font-weight: 600;
}

.seat-manager-run {
  justify-self: start;
  background: var(--blue-dark);
}

.seat-manager-bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.seat-manager-bulk-actions button {
  min-width: 150px;
}

.seat-manager-bulk-actions .seat-manager-run {
  min-width: 0;
}

.seat-manager-parser-status.error {
  color: #a52e34;
}

.seat-table-scroll {
  width: 100%;
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid #d9e4f2;
  border-radius: 10px;
}

.seat-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.seat-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.seat-table thead th {
  padding: 12px 10px;
  border-bottom: 2px solid var(--blue-dark);
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.seat-table tbody th,
.seat-table tbody td {
  padding: 8px;
  border-bottom: 1px solid #d9e4f2;
  text-align: left;
  vertical-align: middle;
}

.seat-table tbody tr:last-child th,
.seat-table tbody tr:last-child td {
  border-bottom: 0;
}

.seat-table tbody tr:nth-child(even) {
  background: #f8fbfd;
}

.seat-table .seat-card h3 {
  white-space: nowrap;
}

.seat-table .seat-card input,
.seat-table .seat-assessment-select,
.seat-table .seat-card button {
  width: 100%;
  min-width: 112px;
}

.seat-table .seat-card .seat-id-input {
  min-width: 220px;
  text-align: left;
}

.seat-table .seat-testing-cell,
.seat-table .seat-result-cell,
.seat-table .seat-clear-cell {
  min-width: 130px;
}

.seat-card h3 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 14px;
  text-align: center;
}

.seat-card input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #c5d1df;
  border-radius: 6px;
  background: #fff;
  color: #12345a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.seat-card input::placeholder {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  opacity: 1;
}

.seat-assessment-select {
  width: 100%;
  min-height: 38px;
  padding: 8px;
  border: 1px solid #c5d1df;
  border-radius: 6px;
  background: #fff;
  color: #12345a;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.seat-assessment-select.passed {
  border-color: #9bcfb2;
  background: #dff3e7;
  color: #0f6b4d;
}

.seat-assessment-select.failed {
  border-color: #e4a0a0;
  background: #fde4e4;
  color: #a52e34;
}

.seat-call-button,
.seat-testing-call-button,
.seat-clear-button,
.seat-manager-action {
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.seat-call-button {
  border: 1px solid #e8cf76;
  background: #fff4c2;
  color: #6b5600;
}

.seat-testing-call-button {
  border: 1px solid #9cc9ed;
  background: #dceeff;
  color: #12558b;
}

.seat-testing-call-button:hover:not(:disabled) {
  background: #c9e4fa;
}

.seat-testing-call-button.called {
  border-color: #12558b;
  background: #e8f3fb;
  color: #12558b;
}

.seat-testing-call-button:disabled {
  cursor: wait;
  opacity: .65;
}

.seat-clear-button {
  border: 1px solid #c83d42;
  background: #fff;
  color: #a52e34;
}

.seat-clear-button:hover:not(:disabled) {
  background: #fff0f0;
}

.seat-clear-button:disabled {
  cursor: wait;
  opacity: .65;
}

.seat-call-button:hover {
  background: #ffec9e;
}

.seat-call-button.called {
  border-color: #c8a83a;
  background: #ffe58a;
  color: #5c4900;
}

.seat-manager-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.seat-manager-action {
  position: relative;
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 11px;
}

.announcement-button-feedback {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 7px);
  left: 50%;
  padding: 6px 10px;
  border: 1px solid #b9d1f4;
  border-radius: 6px;
  background: #fff;
  color: #173f78;
  box-shadow: 0 3px 10px rgba(20, 50, 90, .18);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.announcement-button-feedback.is-error {
  border-color: #e6a3ad;
  color: #b4233c;
}

.clear-data-action {
  background: #c83d42;
}

.view-display-action {
  background: #1769aa;
}

.view-seat-call-display-action {
  background: #6441a5;
}

.assessment-level-action {
  background: var(--blue-dark);
}

.sourcing-announcement-action {
  background: #d7a928;
  color: #3f3100;
}

.seat-availability {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: #f8fbff;
}

.seat-availability-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.seat-availability-heading h3 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 13px;
}

.seat-availability-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: #52657d;
  font-size: 11px;
}

.seat-availability-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.seat-legend-swatch {
  width: 10px;
  height: 10px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.seat-legend-swatch.available {
  border-color: #c5cbd3;
  background: #e8ebef;
}

.seat-legend-swatch.occupied {
  border-color: #22a653;
  background: #34c759;
}

.seat-availability-status {
  margin: 4px 0 7px;
  color: #58708d;
  font-size: 11px;
}

.seat-availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
}

.seat-availability-item {
  display: flex;
  min-width: 0;
  min-height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid;
  border-radius: 8px;
  text-align: center;
}

.seat-availability-item.available {
  border-color: #c5cbd3;
  background: #e8ebef;
  color: #394452;
}

.seat-availability-item.occupied {
  border-color: #22a653;
  background: #34c759;
  color: #073b1b;
}

.seat-availability-item.loading {
  border-color: #d9e1ea;
  background: #f1f4f7;
  color: #8391a1;
}

.seat-availability-number {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.custom-announcement-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.custom-announcement-form label {
  color: var(--text-ink);
  font-size: 13px;
  font-weight: 700;
}

.custom-announcement-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 96px;
  padding: 8px 10px;
  border: 1px solid #c8d8eb;
  border-radius: 7px;
  color: var(--text-ink);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.custom-announcement-form textarea:focus {
  outline: 2px solid rgba(77, 124, 255, 0.5);
  outline-offset: 1px;
}

.custom-announcement-action {
  background: var(--blue-mid);
  justify-self: start;
}

.seat-manager-action:hover {
  filter: brightness(0.92);
}

@media (max-width: 720px) {
  .page-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
  }

  .location-picker {
    flex: 1 1 100%;
    margin-left: 0;
  }

  main {
    padding: 20px 14px 32px;
  }

  .seat-manager-inputs-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
