/* Automation workspace aligned with the Resources & Settings grouped-row split-pane style */
.auto-shell {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  min-height: 620px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong, var(--surface));
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.auto-nav-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.auto-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: none;
  background: var(--muted);
}

.auto-dot.is-ok {
  background: var(--ok, #28714f);
}

.auto-dot.is-warn {
  background: var(--danger, #b42318);
}

.auto-pane-body {
  overflow: visible;
}

.auto-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

.auto-status-lead {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12.5px;
}

.auto-banner {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong, var(--surface));
}

.auto-banner.is-error {
  border-color: color-mix(in srgb, var(--danger, #b42318) 45%, var(--line));
  color: var(--danger, #b42318);
}

.auto-banner.is-notice {
  border-color: color-mix(in srgb, var(--gold) 50%, var(--line));
  background: var(--gold-soft);
  color: var(--text);
}

.auto-chip-ok {
  border-color: color-mix(in srgb, var(--ok, #28714f) 35%, var(--line));
  color: var(--ok, #28714f);
}

.auto-chip-lock {
  border-color: color-mix(in srgb, var(--danger, #b42318) 35%, var(--line));
  color: var(--danger, #b42318);
}

.auto-chip-warn {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  background: color-mix(in srgb, var(--gold-soft) 55%, var(--surface-strong, var(--surface)));
  color: var(--gold-deep, var(--text));
}

[data-theme="dark"] .auto-chip-warn {
  color: var(--gold-bright, var(--gold));
}

.auto-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auto-preset-chip {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg, var(--surface));
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.auto-preset-chip:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--text);
}

.auto-preset-chip.is-active {
  background: var(--gold-soft);
  border-color: color-mix(in srgb, var(--gold) 50%, var(--line));
  color: var(--gold-deep, var(--text));
  font-weight: 600;
}

[data-theme="dark"] .auto-preset-chip.is-active {
  color: var(--gold-bright, var(--gold));
}

.auto-run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auto-lead-meta {
  min-width: 0;
  flex: 1;
}

.auto-lead-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.auto-lead-meta small {
  display: block;
  margin-top: 2px;
}

.auto-ctrl-wide {
  flex: 0 1 320px;
  width: min(320px, 100%);
}

.auto-input {
  width: 100%;
  min-width: 0;
}

.settings-row.auto-row-stack {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}

.settings-row.auto-row-stack > .settings-row-info {
  width: 100%;
  flex: none;
  text-align: left;
}

.settings-row.auto-row-stack .auto-review-top {
  width: 100%;
  align-items: center;
}

.auto-loc-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auto-loc-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--bg, var(--surface));
  color: var(--gold-deep, var(--text));
  flex: none;
}

.auto-loc-logo.has-logo {
  border: 1px solid var(--line);
  background: var(--surface-strong, var(--surface));
  padding: 2px;
}

.auto-loc-logo.has-logo img {
  object-fit: contain;
}

.auto-row-stack.is-flagged {
  background: color-mix(in srgb, var(--danger, #b42318) 4%, var(--surface-strong, var(--surface)));
}

.auto-review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-meta-inline {
  font-size: 12px;
  color: var(--muted);
}

.auto-review-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.auto-textarea,
.auto-reply-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.auto-textarea:focus,
.auto-reply-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.auto-reply-form {
  display: grid;
  gap: 8px;
}

.auto-reply-actions {
  display: flex;
  justify-content: flex-end;
}

.auto-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.auto-media-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg, var(--surface));
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s ease;
}

.auto-media-tile:hover {
  border-color: var(--gold);
}

.auto-media-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-deep, var(--text));
}

[data-theme="dark"] .auto-media-cat {
  color: var(--gold-bright, var(--gold));
}

.auto-media-date {
  font-size: 11px;
  color: var(--muted);
}

.auto-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--gold-deep, var(--gold));
  text-decoration: none;
}

.auto-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .auto-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }
  .auto-ctrl-wide {
    width: 100%;
    flex: 1 1 auto;
  }
}

.auto-ctrl-wide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.auto-ctrl-wide .auto-input {
  flex: 1 1 220px;
}

.auto-photo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.auto-photo-preview-img {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg, var(--surface));
  flex: none;
}

.auto-photo-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auto-photo-preview-meta strong {
  font-size: 12.5px;
  color: var(--text);
}

.auto-photo-preview-meta small {
  font-size: 11.5px;
  color: var(--muted);
}

/* Monthly Invoices tab */
.inv-section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.inv-lang-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg, var(--surface));
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.inv-amount {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.inv-subline {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.inv-err-line {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--danger, #b42318);
}

.inv-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inv-inline-panel {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg, var(--surface));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.inv-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.inv-form-grid label span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.inv-form-grid input,
.inv-form-grid select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.inv-form-grid .inv-wide {
  grid-column: 1 / -1;
}

.inv-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .inv-form-grid {
    grid-template-columns: 1fr;
  }
}
