:root {
  color-scheme: dark;
  --accent: #2dd4bf;
  --accent-soft: #164e63;
  --accent-dark: #0f766e;
  --bg: #121820;
  --surface: #18212c;
  --panel: #202b38;
  --panel-2: #263342;
  --field: #101720;
  --text: #edf7f6;
  --muted: #94a3b8;
  --border: #334155;
  --button-hover: #314156;
  --warning: #f59e0b;
  --card-shadow: #0b1118;
  --card-border: #2d3a4a;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 860px;
  min-height: 560px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  font-size: 10pt;
}

body::-webkit-scrollbar,
.content::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: #0d141c;
}

body::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #2a3a49;
}

body::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

body::-webkit-scrollbar-thumb:active,
.content::-webkit-scrollbar-thumb:active,
.table-wrap::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--accent);
  font-family: "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
  font-size: 24pt;
  font-weight: 700;
  line-height: 1;
}

h2 {
  color: var(--text);
  font-size: 11pt;
  font-weight: 700;
}

form {
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 8.5pt;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  padding: 9px 10px;
  font: 9.5pt "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
}

textarea {
  min-height: 42px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.app-shell {
  display: grid;
  width: min(1160px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  grid-template-rows: auto auto auto 1fr auto;
  background: var(--bg);
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px 20px;
}

.title-row,
.toolbar,
.card-heading,
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.title-row {
  align-items: flex-start;
}

.credit {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9pt;
}

.subtitle {
  margin-top: 14px;
  color: var(--muted);
}

.status-pills,
.primary-actions,
.secondary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.hotkey-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid #1d7181;
  border-radius: 14px;
  background: var(--accent-soft);
  color: #cffafe;
  padding: 3px 10px;
  font-size: 8.5pt;
  font-weight: 700;
  white-space: nowrap;
}

.pill.is-off,
.warning-pill {
  border-color: #7c5a14;
  background: #3d2f12;
  color: #fde68a;
}

.pill.is-on {
  border-color: var(--accent-dark);
}

.toolbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px 16px;
}

.compact-toolbar {
  padding-top: 12px;
  padding-bottom: 12px;
}

.tabbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 24px 12px;
}

.tabbar a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 12px;
  font-size: 9pt;
  font-weight: 700;
  text-decoration: none;
}

.tabbar a:hover {
  background: var(--button-hover);
}

.tabbar a.active {
  border-color: #10978d;
  background: var(--accent-dark);
  color: #ecfeff;
}

.toolbar-copy {
  color: var(--muted);
  font-size: 9pt;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 15px;
  font: 700 9pt "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  background: var(--button-hover);
}

.button.primary {
  border-color: #10978d;
  background: var(--accent-dark);
  color: #ecfeff;
}

.button.primary:hover {
  background: #14b8a6;
}

.button.compact {
  min-height: 30px;
  padding: 7px 13px;
  font-size: 8.5pt;
}

.button.warning-button {
  border-color: #7c5a14;
  color: #fff7ed;
}

.button.warning-button:hover {
  background: #473412;
}

.link-button {
  white-space: nowrap;
}

.content {
  overflow-y: auto;
  padding: 18px 24px 22px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.metric,
.card {
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(11, 17, 24, 0.28);
}

.metric {
  padding: 14px 16px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9pt;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13pt;
  font-weight: 700;
}

.card {
  position: relative;
  margin-bottom: 14px;
  overflow: hidden;
  padding: 16px 16px 16px 22px;
}

.accent-bar {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.card-heading {
  margin-bottom: 12px;
}

.field {
  min-height: 48px;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  padding: 12px 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notice-field {
  min-height: 0;
  margin-bottom: 14px;
  color: #cffafe;
  font-size: 9.5pt;
}

.field:focus-within {
  border-color: var(--accent);
}

.muted-field {
  color: var(--muted);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.health-item {
  display: flex;
  min-height: 58px;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field);
  padding: 10px 12px;
}

.health-item strong,
.health-item span {
  display: block;
}

.health-item strong {
  font-size: 9.5pt;
}

.health-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5pt;
  line-height: 1.35;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  margin-top: 4px;
}

.status-dot.is-ok {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.status-dot.is-warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.masked-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 8.5pt;
}

.warning {
  border-color: #735315;
  background: #241f18;
}

.warning h2 {
  color: #fde68a;
}

.warning ul {
  margin: 0;
  padding-left: 18px;
  color: #fed7aa;
}

.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid > div {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field);
  padding: 12px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 8.5pt;
  font-weight: 700;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 14pt;
}

.settings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.setting-row {
  max-width: 560px;
}

.contact-settings {
  margin-top: 18px;
}

.checkbox-label {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  padding: 9px 10px;
  color: var(--text);
  font-weight: 700;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.sync-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sync-status > div {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field);
  padding: 12px;
}

.sync-status span {
  display: block;
  color: var(--muted);
  font-size: 8.5pt;
  font-weight: 700;
}

.sync-status strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.sync-status .sync-error,
.warning-field {
  border-color: #7c5a14;
  color: #fde68a;
}

.tracker-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.manual-clip-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.qa-update-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 2fr auto;
  gap: 12px;
  align-items: end;
}

.manual-clip-form .wide-field {
  grid-column: span 2;
}

.manual-clip-form .button {
  align-self: end;
}

.subline {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8.5pt;
  line-height: 1.3;
}

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.priority-high {
  border-color: #7f1d1d;
  background: #3f1518;
  color: #fecaca;
}

.priority-medium {
  border-color: #7c5a14;
  background: #3d2f12;
  color: #fde68a;
}

.priority-low {
  border-color: #166534;
  background: #12351f;
  color: #bbf7d0;
}

.priority-normal {
  border-color: #1d7181;
  background: var(--accent-soft);
  color: #cffafe;
}

.queue-table {
  min-width: 920px;
}

.clipqa-shell {
  width: min(1280px, 100%);
}

.clipqa-upload {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) minmax(220px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
}

.clipqa-upload input[type="file"] {
  min-height: 42px;
}

.upload-note {
  margin-top: 10px;
}

.clipqa-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-row {
  max-width: 520px;
  margin-bottom: 12px;
}

.clipqa-table {
  min-width: 1040px;
}

.clipqa-table th:nth-child(1),
.clipqa-table th:nth-child(2),
.clipqa-table th:nth-child(3),
.clipqa-table th:nth-child(4) {
  width: 1%;
}

.clipqa-table tr.is-reviewed td {
  background: rgba(18, 53, 31, 0.24);
}

.clipqa-table tr.is-reviewed td:nth-child(5) {
  color: #bbf7d0;
}

.review-check {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
}

.review-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.review-check span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  cursor: pointer;
}

.review-check input:focus-visible + span {
  border-color: var(--accent);
  outline: 2px solid rgba(45, 212, 191, 0.28);
  outline-offset: 2px;
}

.review-check input:checked + span {
  border-color: #166534;
  background: #12351f;
}

.review-check input:checked + span::before {
  content: "X";
  color: #bbf7d0;
  font-size: 12pt;
  font-weight: 700;
  line-height: 1;
}

.description-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.copy-description {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  padding: 5px 10px;
  font: 700 8.5pt "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.copy-description:hover {
  background: var(--button-hover);
}

.copy-description.is-copied {
  border-color: #166534;
  background: #12351f;
  color: #bbf7d0;
}

.steps-dropdown {
  position: relative;
  width: max-content;
  max-width: 180px;
}

.steps-dropdown summary {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid #1d7181;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #cffafe;
  padding: 5px 10px;
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  list-style: none;
}

.steps-dropdown summary::-webkit-details-marker {
  display: none;
}

.steps-dropdown summary::after {
  content: "v";
  margin-left: 7px;
  color: var(--accent);
  font-size: 8pt;
}

.steps-dropdown[open] summary {
  border-color: #10978d;
  background: var(--accent-dark);
  color: #ecfeff;
}

.steps-dropdown[open] summary::after {
  content: "^";
}

.steps-panel {
  position: absolute;
  z-index: 5;
  top: 34px;
  left: 0;
  display: flex;
  width: 240px;
  max-height: 220px;
  flex-wrap: wrap;
  gap: 6px;
  overflow: auto;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  background: var(--field);
  box-shadow: 0 14px 30px rgba(11, 17, 24, 0.42);
  padding: 10px;
}

.steps-panel span {
  display: inline-flex;
  min-width: 30px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  padding: 4px 8px;
  font-size: 8.5pt;
  font-weight: 700;
}

.issue-list {
  margin: 0;
  padding-left: 18px;
}

.issue-list li + li {
  margin-top: 5px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  background: var(--field);
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 9.5pt;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

tr:first-child th {
  border-top: 0;
}

tbody tr:nth-child(even) {
  background: rgba(38, 51, 66, 0.62);
}

th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: var(--text);
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.row-link {
  color: #cffafe;
  font-weight: 700;
  text-decoration: none;
}

.row-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.app-footer {
  min-height: 38px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 24px;
  font-size: 9pt;
}

::selection {
  background: var(--accent-dark);
  color: var(--text);
}

@media (max-width: 900px) {
  html {
    min-width: 0;
  }

  .app-shell {
    width: 100%;
  }

  .title-row,
  .toolbar,
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics-grid,
  .overview-grid,
  .overview-layout,
  .health-grid,
  .columns,
  .sync-status,
  .tracker-actions,
  .manual-clip-form,
  .qa-update-form,
  .clipqa-upload,
  .clipqa-metrics {
    grid-template-columns: 1fr;
  }

  .inline-form,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .manual-clip-form .wide-field {
    grid-column: auto;
  }

  .secondary-actions {
    width: 100%;
  }
}
