:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202522;
  background: #f1f3ef;
  letter-spacing: 0;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f1f3ef;
}

.topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 3px solid #d8a928;
  background: #202522;
  color: #fff;
}

.identity,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar strong {
  font-size: 20px;
}

.identity > span {
  color: #c9cfca;
  font-size: 14px;
}

.status {
  min-width: 72px;
  padding: 5px 9px;
  border: 1px solid #57605a;
  border-radius: 999px;
  color: #f4cf65;
  font-size: 13px;
  text-align: center;
}

.status[data-tone="ready"] {
  border-color: #4b8c71;
  color: #8be0b8;
}

.status[data-tone="error"] {
  border-color: #b7655c;
  color: #ffaaa0;
}

.queue-status {
  color: #d5dad6;
  font-size: 13px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid #57605a;
  border-radius: 4px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #f0c54e;
  outline: none;
  background: #303630;
}

main {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.remote-camera-panel {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  margin-bottom: 14px;
  border: 2px solid #b34336;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 12px rgb(32 37 34 / 18%);
}

.remote-camera-video {
  display: block;
  width: 100%;
  height: 220px;
  background: #111;
  object-fit: contain;
}

.remote-camera-content {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.remote-camera-content strong {
  display: block;
  margin-bottom: 7px;
  color: #8a2e24;
  font-size: 18px;
}

.remote-camera-content p {
  overflow-wrap: anywhere;
}

.remote-camera-content button {
  flex: 0 0 auto;
}

.session-panel,
.empty-state {
  padding: 32px;
  border: 1px solid #d4d8d2;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(32 37 34 / 8%);
}

h1 {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: #606862;
}

button,
input,
select,
textarea {
  min-height: 48px;
  font: inherit;
}

button {
  border: 1px solid #aeb5af;
  border-radius: 4px;
  padding: 0 16px;
  color: #202522;
  background: #fff;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: #28775a;
  outline: 2px solid rgb(40 119 90 / 18%);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  border-color: #246b51;
  color: #fff;
  background: #246b51;
}

.button-primary:hover,
.button-primary:focus-visible {
  border-color: #174d39;
  background: #174d39;
}

.button-danger {
  border-color: #b34336;
  color: #8a2e24;
  background: #fff;
}

.queue-panel {
  margin-bottom: 14px;
  border: 1px solid #d4d8d2;
  border-left: 5px solid #d8a928;
  border-radius: 6px;
  padding: 16px 18px;
  background: #fff;
}

.queue-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.queue-row > div {
  min-width: 0;
  flex: 1;
}

.queue-row + .queue-row {
  margin-top: 8px;
  border-top: 1px solid #e0e3df;
  padding-top: 8px;
}

.queue-row strong,
.queue-row small {
  display: block;
}

.queue-row small {
  margin-top: 3px;
  color: #687069;
}

.queue-error {
  color: #9a3429 !important;
}

.task-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 4fr);
  align-items: start;
  gap: 14px;
}

.recent-tasks {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.recent-tasks-heading {
  margin: 0 0 10px;
  font-size: 17px;
}

.recent-task-list {
  display: grid;
  max-height: calc(100vh - 110px);
  gap: 8px;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
}

.recent-task-card {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 84px;
  align-content: center;
  gap: 9px;
  border-left: 5px solid #7b8580;
  padding: 12px;
  text-align: left;
}

.recent-task-card[data-status="pending"] {
  border-left-color: #d8a928;
}

.recent-task-card[data-status="acknowledged"],
.recent-task-card[data-status="executing"] {
  border-left-color: #28775a;
}

.recent-task-card[data-status="rejected"],
.recent-task-card[data-status="timeout"] {
  border-left-color: #b34336;
}

.recent-task-card[data-status="approved"] {
  border-left-color: #39835f;
}

.recent-task-card[aria-current="true"] {
  border-color: #28775a;
  border-left-color: #28775a;
  background: #edf6f1;
  box-shadow: 0 1px 3px rgb(32 37 34 / 14%);
}

.recent-task-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.recent-task-meta {
  display: grid;
  gap: 4px;
  color: #687069;
  font-size: 12px;
}

.recent-task-status {
  color: #37413b;
  font-weight: 600;
}

.recent-task-deadline {
  overflow-wrap: anywhere;
}

.task-detail {
  min-width: 0;
}

.task-card {
  border: 1px solid #d4d8d2;
  border-left: 5px solid #7b8580;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(32 37 34 / 8%);
}

.task-card[data-status="pending"] {
  border-left-color: #d8a928;
}

.task-card[data-status="acknowledged"],
.task-card[data-status="executing"] {
  border-left-color: #28775a;
}

.task-card[data-status="rejected"],
.task-card[data-status="timeout"] {
  border-left-color: #b34336;
}

.task-card[data-status="approved"] {
  border-left-color: #39835f;
}

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
}

.task-header h2 {
  margin: 0;
  font-size: 19px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 8px;
  color: #687069;
  font-size: 13px;
}

.task-body {
  padding: 0 22px 20px;
}

.task-description {
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.task-attachments {
  margin-bottom: 16px;
  border-left: 3px solid #d8a928;
  padding: 10px 12px;
  background: #faf8ef;
}

.task-attachments h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-button {
  min-height: 42px;
  border-color: #9eb7aa;
  padding: 7px 12px;
  color: #1d634a;
  background: #fff;
  overflow-wrap: anywhere;
  text-align: left;
}

.file-link {
  color: #1d634a;
  overflow-wrap: anywhere;
}

body.viewer-open {
  overflow: hidden;
}

.attachment-viewer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  min-width: 320px;
  flex-direction: column;
  color: #202522;
  background: #454b47;
}

.viewer-header {
  display: grid;
  min-height: 62px;
  flex: 0 0 auto;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 16px;
  border-bottom: 3px solid #d8a928;
  color: #fff;
  background: #202522;
}

.viewer-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-header output {
  max-width: 360px;
  color: #d5dad6;
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

.viewer-header output[data-tone="error"] {
  color: #ffaaa0;
}

.viewer-toolbar {
  display: flex;
  min-height: 62px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 7px 12px;
  border-bottom: 1px solid #cbd0cc;
  background: #f8f9f7;
  white-space: nowrap;
}

.viewer-tool-group {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.viewer-tool-group output {
  min-width: 62px;
  color: #4c554f;
  font-size: 13px;
  text-align: center;
}

.viewer-icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 22px;
}

.viewer-header .viewer-icon-button {
  border-color: #57605a;
  color: #fff;
  background: transparent;
}

.viewer-modes {
  border: 1px solid #aeb5af;
  border-radius: 4px;
  overflow: hidden;
}

.viewer-modes button {
  min-height: 42px;
  border: 0;
  border-radius: 0;
  padding: 0 12px;
}

.viewer-modes button + button {
  border-left: 1px solid #cbd0cc;
}

.viewer-modes button[aria-pressed="true"] {
  color: #fff;
  background: #246b51;
}

.viewer-color {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #aeb5af;
  border-radius: 4px;
  background: #fff;
}

.viewer-color input {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 0;
  padding: 2px;
  background: transparent;
}

.viewer-width {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: #4c554f;
  font-size: 13px;
}

.viewer-width input {
  width: 96px;
  min-height: 42px;
}

.viewer-save {
  min-width: 96px;
  flex: 0 0 auto;
}

.viewer-save[data-dirty="true"]::after {
  content: " *";
}

.viewer-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 24px;
  overscroll-behavior: contain;
}

.viewer-document {
  position: relative;
  min-width: 1px;
  min-height: 1px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 4px 18px rgb(0 0 0 / 28%);
}

.viewer-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

.viewer-text {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: #202522;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
  tab-size: 4;
  white-space: pre-wrap;
}

.annotation-stage {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotation-stage.is-drawing,
.annotation-stage.is-drawing canvas {
  touch-action: none;
}

@media (max-width: 700px) {
  .viewer-header {
    grid-template-columns: 44px minmax(0, 1fr);
    padding-right: 10px;
  }

  .viewer-header output {
    display: none;
  }

  .viewer-scroll {
    padding: 12px;
  }
}

.status-badge {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #3e4741;
  background: #e7eae7;
  font-size: 13px;
  text-align: center;
}

.task-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-left: 3px solid #b34336;
  color: #762a22;
  background: #fff1ef;
  white-space: pre-wrap;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.submission-form {
  display: grid;
  gap: 10px;
}

.submission-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recording-preview {
  position: relative;
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #606862;
  border-radius: 4px;
  background: #111;
}

.recording-preview-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #111;
  object-fit: contain;
}

.recording-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgb(138 46 36 / 92%);
  font-size: 13px;
  font-weight: 600;
}

.pending-files {
  display: grid;
  gap: 6px;
}

.pending-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  min-height: 42px;
  border: 1px solid #d8ddd8;
  padding: 5px 8px 5px 12px;
  background: #fafbf9;
}

.pending-file-content {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.pending-file-content span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.local-media {
  display: block;
  width: min(100%, 520px);
}

.local-video {
  max-height: 320px;
  background: #111;
  object-fit: contain;
}

.queue-row .local-media {
  margin-top: 8px;
}

.icon-action {
  width: 48px;
  min-width: 48px;
  padding: 0;
  font-size: 24px;
}

.form-feedback {
  color: #687069;
}

.submission-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid #aeb5af;
  border-radius: 4px;
  padding: 12px;
  color: #202522;
  background: #fff;
}

.submission-form textarea:focus {
  border-color: #28775a;
  outline: 2px solid rgb(40 119 90 / 18%);
}

.submission-history {
  margin-top: 16px;
  border-top: 1px solid #e0e3df;
  padding-top: 12px;
}

.submission-history summary {
  min-height: 48px;
  cursor: pointer;
  color: #49514c;
  line-height: 48px;
}

.history-entry {
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid #e0e3df;
  border-radius: 4px;
  background: #fafbf9;
}

.history-entry strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.history-entry p + p {
  margin-top: 6px;
}

.stored-file {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: 8px;
}

.file-image,
.file-video {
  width: min(100%, 560px);
  max-height: 360px;
  border: 1px solid #d4d8d2;
  background: #111;
  object-fit: contain;
}

.file-media {
  width: min(100%, 560px);
}

.empty-state {
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 760px) {
  .remote-camera-panel {
    position: static;
    grid-template-columns: minmax(0, 1fr);
  }

  .remote-camera-video {
    height: auto;
    max-height: 42vh;
    aspect-ratio: 16 / 9;
  }

  .remote-camera-content {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

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

  .recent-tasks {
    position: static;
  }

  .recent-task-list {
    grid-auto-columns: minmax(190px, 70vw);
    grid-auto-flow: column;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
  }

  .recent-task-card {
    scroll-snap-align: start;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: auto;
    align-items: center;
    padding: 14px 16px;
  }

  .identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .queue-status {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  main {
    margin-top: 16px;
  }

  .task-header {
    padding: 16px 16px 12px;
  }

  .task-body {
    padding: 0 16px 16px;
  }
}
