:root {
  --window-bg: #d4d0c8;
  --panel-bg: #ece9d8;
  --face: #d4d0c8;
  --border-dark: #808080;
  --border-mid: #a9a9a9;
  --border-light: #ffffff;
  --shadow: #404040;
  --text: #000000;
  --muted: #333333;
  --selection: #0a64ad;
  --selection-text: #ffffff;
  --input-bg: #ffffff;
  --font: Tahoma, "Segoe UI", Arial, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font: 14px/1.35 var(--font);
  color: var(--text);
  background: var(--window-bg);
  overflow: auto;
}

body::before,
.ambient,
.badge-row {
  display: none !important;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}

.brandline {
  margin: 4px 0 0;
  font-size: 1.03rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--muted);
}

.deck {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.4;
}

.header-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.header-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 386px) minmax(0, 1fr);
  gap: 14px;
}

.sidebar,
.workspace {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.card,
.subcard {
  border: 1px solid var(--border-dark);
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
}

.drop-card,
.queue-card {
  padding: 12px;
}

.dropzone {
  min-height: 90px;
  border: 1px solid var(--border-mid);
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  outline: 2px solid var(--selection);
  outline-offset: -4px;
  background: #e6e3d9;
}

.drop-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.note {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.mini-chip-row,
.queue-summary {
  display: none !important;
}

.queue-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.section-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.queue-list {
  flex: 1;
  min-height: 420px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid var(--border-dark);
  background: var(--input-bg);
  box-shadow:
    inset 1px 1px 0 var(--shadow),
    inset -1px -1px 0 var(--border-light);
  padding: 2px;
  display: flex;
  flex-direction: column;
}

.queue-item {
  display: flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 6px;
  cursor: default;
  user-select: none;
  outline: none;
}

.queue-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item.selected {
  background: var(--selection);
  color: var(--selection-text);
}

.button-row,
.counter-row,
.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-toolbar {
  margin-top: 8px;
}

button,
.button-like {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  border-radius: 0;
  background: linear-gradient(#f2f0ea, #d9d6cc);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  text-decoration: none;
  padding: 6px 14px;
  min-height: 30px;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
}

button:hover:not(:disabled),
.button-like:hover {
  background: linear-gradient(#f8f6f0, #dfdccf);
}

button:active:not(:disabled),
.button-like:active {
  box-shadow:
    inset 2px 2px 0 var(--shadow),
    inset -1px -1px 0 var(--border-light);
  transform: translateY(1px);
}

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

button.primary {
  font-weight: 700;
}

.file-picker-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-strip {
  display: flex;
  gap: 2px;
  padding: 0 0 0 2px;
  margin-bottom: -1px;
  overflow-x: auto;
}

.tab-button {
  flex: 0 0 auto;
  border: 1px solid var(--border-dark);
  border-bottom: none;
  border-radius: 0;
  padding: 6px 14px 7px;
  background: linear-gradient(#e8e4da, #d9d5ca);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 #b9b4a6;
}

.tab-button.active {
  position: relative;
  top: 1px;
  background: var(--panel-bg);
  z-index: 1;
}

.tab-panels {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-dark);
  background: var(--panel-bg);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
  padding: 8px;
}

.tab-panel {
  display: none;
  min-height: 0;
  height: 100%;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflow-line {
  margin: 0 0 2px;
}

.group-frame {
  padding: 10px;
}

.group-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.detail-stack {
  display: grid;
  gap: 8px;
}

.detail-line {
  margin: 0;
  line-height: 1.35;
}

.visually-hidden,
#preview-state,
#preview-sidecars {
  display: none !important;
}

.actions-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions-row {
  justify-content: space-between;
}

.status-pill {
  margin-left: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: auto;
  color: var(--text);
  font-weight: 400;
}

.status-pill.is-working {
  color: #1f4da0;
}

.status-pill.is-success {
  color: #1f6b2c;
}

.status-pill.is-error {
  color: #b91c1c;
}

.metadata-filler {
  flex: 1;
  min-height: 280px;
  border: 1px solid var(--border-mid);
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
}

.toggle-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

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

.toggle strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

.toggle small {
  display: block;
  color: var(--muted);
}

.field-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.field-row.locked {
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
}

.field-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border-dark);
  background: var(--input-bg);
  box-shadow:
    inset 1px 1px 0 var(--shadow),
    inset -1px -1px 0 var(--border-light);
}

.field-lock strong {
  font-weight: 700;
}

.field-value,
.field-input,
.field-select {
  border: 1px solid var(--border-dark);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 0;
  box-shadow:
    inset 1px 1px 0 var(--shadow),
    inset -1px -1px 0 var(--border-light);
}

.field-select {
  padding-right: 22px;
}

.field-remove {
  padding-inline: 12px;
}

.log-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.log-view {
  flex: 1;
  min-height: 320px;
  overflow: auto;
  border: 1px solid var(--border-dark);
  background: var(--input-bg);
  box-shadow:
    inset 1px 1px 0 var(--shadow),
    inset -1px -1px 0 var(--border-light);
  padding: 8px;
  font-family: var(--mono);
  font-size: 12px;
}

.log-line {
  margin: 0 0 2px;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.info {
  color: var(--text);
}

.log-line.success {
  color: #1f6b2c;
}

.log-line.error {
  color: #b91c1c;
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--border-light),
    inset -1px -1px 0 var(--shadow);
  padding: 2px 8px;
  min-height: 22px;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
}

.preview-card,
.preview-media,
.preview-copy {
  display: none !important;
}

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

  .queue-card {
    min-height: 420px;
  }

  .actions-row,
  .counter-row {
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 8px;
  }

  .button-row,
  .counter-row,
  .actions-row {
    gap: 6px;
  }

  .field-row,
  .field-row.locked {
    grid-template-columns: 1fr;
  }
}
