:root {
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #1d2129;
  background: #e9ebee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e9ebee;
  color: #1d2129;
}

.site-footer {
  margin: 16px 0 20px;
  color: #606770;
  font-size: 12px;
}

.policy-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.policy-links a {
  color: #365899;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #ccd6eb;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f5fb 100%);
  font-weight: 600;
}

.policy-links a:hover {
  border-color: #97addd;
  background: #eef2fb;
}

.policy-links a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(66, 103, 178, 0.2);
}

.wrap {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 12px;
}

.topbar {
  background: #3b5998;
  border-bottom: 1px solid #29487d;
}

.topbar-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.topbar p {
  margin: 0;
  color: #dfe3ee;
  font-size: 13px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.connection {
  margin-top: 10px;
}

.card {
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 4px;
  margin-bottom: 10px;
  padding: 10px;
}

h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

h3 {
  margin: 10px 0 6px;
  font-size: 13px;
}

label {
  display: block;
  font-size: 12px;
  color: #4b4f56;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid #ccd0d5;
  border-radius: 3px;
  padding: 7px 8px;
  background: #fff;
  color: #1d2129;
}

textarea {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

button {
  border: 1px solid #365899;
  border-radius: 3px;
  background: #4267b2;
  color: #fff;
  padding: 7px 10px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 13px;
}

button:hover {
  background: #365899;
}

.stack {
  display: grid;
  gap: 6px;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid #ccd0d5;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f9fafc);
}

.file-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #365899;
  background: #4267b2;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.file-picker-name {
  min-width: 0;
  flex: 1;
  font-size: 12px;
  color: #4b4f56;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-hidden:focus-visible + .file-picker,
.file-picker:hover {
  border-color: #97addd;
  box-shadow: 0 0 0 2px rgba(66, 103, 178, 0.12);
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.option-toggle {
  margin-top: 6px;
  display: block;
  border: 1px solid #d7dce6;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  cursor: pointer;
}

.option-toggle-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
}

.option-toggle-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #4267b2;
  margin-top: 1px;
}

.option-toggle-label {
  min-width: 0;
  display: grid;
  gap: 1px;
  font-size: 12px;
  color: #4b4f56;
}

.option-toggle-label strong {
  font-size: 12px;
  color: #1d2129;
}

.option-toggle-label small {
  font-size: 11px;
  color: #606770;
}

.option-toggle:hover {
  border-color: #9fb4e0;
  box-shadow: 0 0 0 2px rgba(66, 103, 178, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
}

.option-toggle:focus-within {
  border-color: #97addd;
  box-shadow: 0 0 0 3px rgba(66, 103, 178, 0.14), 0 1px 2px rgba(16, 24, 40, 0.06);
}

.actions.single {
  grid-template-columns: 1fr;
}

.progress-wrap {
  margin-top: 8px;
  display: none;
}

.progress-wrap.visible {
  display: block;
}

.progress-track {
  height: 8px;
  width: 100%;
  background: #e4e6eb;
  border: 1px solid #d7dbe1;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(
    -45deg,
    #4267b2,
    #4267b2 10px,
    #4e74c0 10px,
    #4e74c0 20px
  );
  transition: width 0.25s ease;
  animation: progress-stripes 1.2s linear infinite;
}

.progress-label {
  display: none;
}

@keyframes progress-stripes {
  from { background-position: 0 0; }
  to { background-position: 40px 0; }
}

.download-link {
  display: inline-block;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 3px;
  border: 1px solid #365899;
  background: #4267b2;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
}

.download-link:hover {
  background: #365899;
}

.download-link.disabled {
  background: #a7b4d6;
  border-color: #8ea0cc;
  pointer-events: none;
}

.advanced summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.legal-page {
  margin-top: 12px;
}

.legal-card h2 {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  color: #29487d;
  border-left: 3px solid #4267b2;
  padding-left: 8px;
}

.legal-card p,
.legal-card li {
  font-size: 12px;
  line-height: 1.7;
}

.legal-card ul {
  margin: 0 0 8px 18px;
  padding: 0;
}

.legal-card {
  border-radius: 8px;
  border-color: #d8deea;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.legal-card .muted {
  margin-top: 0;
  color: #606770;
  font-weight: 600;
  background: #f0f3f9;
  border: 1px solid #dbe2f0;
  border-radius: 6px;
  padding: 6px 8px;
}

.advanced-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f5f6f7;
  border: 1px solid #dadde1;
  border-radius: 3px;
  padding: 8px;
  min-height: 32px;
  max-height: 120px;
  overflow: auto;
  font-size: 12px;
}

.result.phase-status {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: normal;
  font-weight: 600;
}

.result.phase-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #90949c;
  flex: 0 0 auto;
}

.result.phase-status.state-neutral {
  border-color: #dadde1;
  background: #f5f6f7;
  color: #4b4f56;
}

.result.phase-status.state-running {
  border-color: #bcd2ff;
  background: #f0f5ff;
  color: #365899;
}

.result.phase-status.state-running::before {
  background: #4267b2;
}

.result.phase-status.state-success {
  border-color: #cde8d1;
  background: #f3fbf4;
  color: #2f6f3e;
}

.result.phase-status.state-success::before {
  background: #3d8b4e;
}

.result.phase-status.state-warning {
  border-color: #f2dfb1;
  background: #fffaf0;
  color: #7a5a00;
}

.result.phase-status.state-warning::before {
  background: #b08900;
}

.result.phase-status.state-error {
  border-color: #f2c6c6;
  background: #fff5f5;
  color: #b30000;
}

.result.phase-status.state-error::before {
  background: #d93025;
}

.result.compact {
  min-height: 28px;
}

.result.transcript {
  min-height: 72px;
  max-height: none;
  overflow: visible;
}

#masksResult {
  max-height: none;
  overflow: visible;
}

.mask-summary {
  display: grid;
  gap: 8px;
}

.mask-summary-head {
  font-weight: 700;
  color: #1d2129;
}

.mask-summary-types {
  color: #606770;
  font-size: 12px;
}

.mask-list {
  display: grid;
  gap: 6px;
}

.mask-row {
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 4px;
  padding: 6px 8px;
}

.mask-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.mask-index {
  color: #606770;
  font-size: 12px;
  font-weight: 700;
}

.mask-badge {
  background: #eef1f6;
  border: 1px solid #d4d9e2;
  color: #365899;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.mask-badge.pii-phone_number {
  border-color: #4c8c5a;
  color: #2f6f3e;
}

.mask-badge.pii-email {
  border-color: #4b6cb7;
  color: #2d4f96;
}

.mask-badge.pii-address {
  border-color: #9b7d2e;
  color: #7a5a00;
}

.mask-badge.pii-person_name {
  border-color: #8e5fa6;
  color: #6f3f8a;
}

.mask-badge.pii-organization {
  border-color: #3f7a88;
  color: #2e5f6b;
}

.mask-badge.pii-date,
.mask-badge.pii-custom {
  border-color: #8b8b8b;
  color: #5f5f5f;
}

.mask-badge.masked {
  background: #f7fbff;
}

.mask-badge.review {
  background: #fffaf0;
}

.mask-meta {
  color: #606770;
  font-size: 11px;
}

.mask-preview {
  color: #1d2129;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mask-empty {
  color: #606770;
}

.transcript-list {
  display: grid;
  gap: 8px;
}

.transcript-inline {
  font-size: 14px;
  line-height: 1.8;
  color: #1d2129;
  word-break: break-word;
}

.transcript-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #4b4f56;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  font-size: 11px;
}

.utterance-row {
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 4px;
  padding: 8px;
}

.utterance-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.utterance-index {
  color: #606770;
  font-size: 12px;
  font-weight: 700;
}

.utterance-time {
  color: #365899;
  font-size: 12px;
  font-weight: 700;
}

.utterance-text {
  color: #1d2129;
  font-size: 13px;
  line-height: 1.45;
}

.utterance-note {
  margin-top: 6px;
  color: #606770;
  font-size: 11px;
}

.utterance-pii {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pii-inline {
  padding: 0 1px;
  border-bottom: 2px solid transparent;
}

.pii-inline.masked {
  background: transparent;
}

.pii-inline.review {
  background: transparent;
}

.pii-inline.pii-phone_number {
  border-color: #4c8c5a;
}

.pii-inline.pii-email {
  border-color: #4b6cb7;
}

.pii-inline.pii-address {
  border-color: #9b7d2e;
}

.pii-inline.pii-person_name {
  border-color: #8e5fa6;
}

.pii-inline.pii-organization {
  border-color: #3f7a88;
}

.pii-inline.pii-date,
.pii-inline.pii-custom {
  border-color: #8b8b8b;
}

.pii-badge {
  border-radius: 999px;
  border: 1px solid;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.pii-badge.masked {
  background: #f3fbf4;
  border-color: #cde8d1;
  color: #2f6f3e;
}

.pii-badge.review {
  background: #fffaf0;
  border-color: #f2dfb1;
  color: #7a5a00;
}

.result.error {
  border-color: #e74c3c;
  color: #b30000;
}

.muted {
  margin: 6px 0 0;
  font-size: 12px;
  color: #606770;
}

code {
  background: #f0f2f5;
  border: 1px solid #dadde1;
  border-radius: 3px;
  padding: 1px 4px;
}

@media (max-width: 960px) {
  .flow-grid {
    grid-template-columns: 1fr;
  }

  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .topbar p {
    display: none;
  }

  .result.transcript {
    min-height: 220px;
  }
}
