/* A restrained working tool, not a marketing surface: system font stack,
   compact spacing, functional colour only (status/error), light and dark
   variants via prefers-color-scheme. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --border: #d0d0d0;
  --muted: #6b6b6b;
  --accent: #2b4c7e;
  --error-bg: #fdecea;
  --error-fg: #8a1f11;
  --field-bg: #fafafa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e6e6e6;
    --border: #3a3d42;
    --muted: #9a9a9a;
    --accent: #7fa4dd;
    --error-bg: #3a1f1c;
    --error-fg: #ff8f7e;
    --field-bg: #1f2227;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.app-header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.lang-switch button {
  margin-left: 0.25rem;
}

.lang-switch button.active {
  font-weight: 600;
  border-color: var(--accent);
}

.section {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.section h2 {
  margin-top: 0;
  font-size: 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.field {
  margin-bottom: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.4rem;
  background: var(--field-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
}

button.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.string-list-row,
.tag-list-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.string-list-row input {
  flex: 1;
}

.tag-list-row input {
  flex: 1;
}

.tag-list-row-fixed {
  color: var(--muted);
  align-items: center;
}

.role-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.role-checkbox {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.hidden {
  display: none;
}

.banner {
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.banner-error {
  background: var(--error-bg);
  color: var(--error-fg);
}

.startup-error {
  background: var(--error-bg);
  color: var(--error-fg);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem auto;
  max-width: 40rem;
}

.startup-error h1 {
  font-size: 1.1rem;
  margin-top: 0;
}

pre {
  white-space: pre-wrap;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
}

dl {
  margin: 0;
}

dt {
  font-weight: 600;
  margin-top: 0.4rem;
}

dd {
  margin: 0 0 0.2rem;
}

.envelope-summary {
  margin-top: 0.75rem;
}

.agent-actions,
.summary-actions,
.journal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.operation-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.csr-prefill-marker {
  color: var(--accent);
  font-weight: 400;
  font-size: 0.8rem;
}

.csr-rejected-note {
  color: var(--error-fg);
}

.crl-candidates {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 10rem;
  overflow-y: auto;
}

.crl-candidate-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

/* Tabs */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tab-bar button {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 0.5rem 0.9rem;
}

.tab-bar button.active {
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Section headings with an inline help ("?") button */

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-help {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  font-size: 0.8rem;
}

/* Modal (help panels) */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-panel {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 34rem;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body p {
  margin: 0.5rem 0;
}

.modal-body pre {
  font-size: 0.8rem;
}

/* Snapshot: mode picker + inventory constructor */

.snapshot-mode-picker {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.snapshot-mode-picker label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.host-list-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.host-list-row input {
  flex: 1;
}

.snapshot-constructor-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Agent status indicator */

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.agent-status::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}

.agent-status-connected::before {
  background: #2f9e44;
}

.agent-status-connecting::before {
  background: #e8a33d;
}

.agent-status-error::before {
  background: var(--error-fg);
}

.roles-narrowed-note {
  margin-top: -0.4rem;
}
