/*
 * parsh.css — dark 8-bit terminal theme
 * Coexists with Tailwind. Provides:
 *  1. Theme tokens (CSS vars)
 *  2. Bulma-compatible classes (.box, .button, .input, .tag, .notification, .modal,
 *     .level, .columns, .field, etc.) so existing markup + JS class toggles still work
 *  3. A few app-specific helpers (.parsh-card, .parsh-toast, .pixel-divider)
 */

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --surface2:  #1c1c1c;
  --surface3:  #232323;
  --edge:      #2a2a2a;
  --edgehi:    #3a3a3a;
  --ink:       #e6e6e6;
  --dim:       #888888;
  --mute:      #5a5a5a;
  --crt:       #22c55e;
  --crtdim:    #16a34a;
  --amber:     #fbbf24;
  --amberdim:  #d97706;
  --danger:    #f87171;
  --dangerdim: #dc2626;
  --info:      #60a5fa;
  --infodim:   #2563eb;
  --violet:    #a78bfa;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--crt); }

code, pre, kbd { font-family: inherit; }

/* Selection */
::selection { background: var(--crt); color: var(--bg); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--edge); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--edgehi); }

/* Focus ring — flat, sharp */
:focus { outline: none; }
:focus-visible {
  outline: 1px solid var(--crt);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- *
 * Bulma-shaped primitives, restyled for the dark 8-bit theme.
 * Existing templates continue to work; JS that toggles is-* classes
 * still produces the right visual.
 * ---------------------------------------------------------------- */

.section { padding: 1rem 0; }
.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 1rem; }

/* Box / card surfaces */
.box,
.parsh-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  padding: 1rem 1.25rem;
}
.box.is-small { padding: 0.75rem 0.9rem; }
.notification {
  background: var(--surface);
  border: 1px solid var(--edge);
  padding: 0.85rem 1rem;
  color: var(--ink);
}
.notification.is-light  { background: var(--surface2); }
.notification.is-info   { border-left: 3px solid var(--info); }
.notification.is-danger { border-left: 3px solid var(--danger); }
.notification.is-success{ border-left: 3px solid var(--crt); }
.notification.is-warning{ border-left: 3px solid var(--amber); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
}
.card-content { padding: 0.9rem 1rem; flex: 1; }

/* Titles */
.title {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
.title.is-1 { font-size: 1.6rem; }
.title.is-2 { font-size: 1.4rem; }
.title.is-3 { font-size: 1.2rem; }
.title.is-4 { font-size: 1.05rem; }
.title.is-5 { font-size: 0.95rem; }
.title.is-6 { font-size: 0.85rem; }
.subtitle {
  color: var(--dim);
  font-weight: 400;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}
.subtitle.is-5 { font-size: 0.95rem; color: var(--ink); }
.subtitle.is-6 { font-size: 0.85rem; }
.subtitle.is-7 { font-size: 0.75rem; }
.has-text-grey { color: var(--dim) !important; }
.has-text-danger { color: var(--danger) !important; }
.has-text-success { color: var(--crt) !important; }
.has-text-white { color: var(--ink) !important; }
.has-text-weight-semibold { font-weight: 600; }
.has-text-centered { text-align: center; }
.is-size-5 { font-size: 0.95rem; }
.is-size-6 { font-size: 0.85rem; }
.is-size-7 { font-size: 0.75rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }

/* Form controls */
.label {
  display: block;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.label.is-small { font-size: 0.65rem; margin-bottom: 0.25rem; }
.field { margin-bottom: 0.85rem; }
.control { display: block; }
.help, .help-text, .help-block {
  font-size: 0.7rem;
  color: var(--mute);
  margin-top: 0.35rem;
}
.help-text { line-height: 1.35; }

.input, .textarea, select, .control[type] {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--edge);
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.3;
  transition: border-color 0.1s, background 0.1s;
}
.input.is-small, .textarea.is-small, select.is-small {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}
.input:hover, .textarea:hover, select:hover { border-color: var(--edgehi); }
.input:focus, .textarea:focus, select:focus {
  border-color: var(--crt);
  background: var(--surface);
}
.input.is-danger, .textarea.is-danger, select.is-danger { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--mute); }
.textarea { resize: vertical; min-height: 100px; }

/* WTForms still emits class="control" for inputs in some places */
input.control, textarea.control, select.control {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--edge);
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
}
input.control:focus, textarea.control:focus, select.control:focus { border-color: var(--crt); background: var(--surface); }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
}
.select { display: block; position: relative; }
.select.is-fullwidth, .select.is-fullwidth select { width: 100%; }
.select select { width: 100%; }

/* Checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.85rem;
  user-select: none;
}
.checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--bg);
  border: 1px solid var(--edgehi);
  cursor: pointer;
  position: relative;
  margin: 0;
  flex-shrink: 0;
}
.checkbox input[type="checkbox"]:checked {
  background: var(--crt);
  border-color: var(--crt);
}
.checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: var(--bg);
  clip-path: polygon(15% 50%, 38% 75%, 85% 18%, 90% 30%, 38% 90%, 8% 60%);
}

/* Buttons */
.button, button.button, input[type="submit"].button, a.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface2);
  color: var(--ink);
  border: 1px solid var(--edgehi);
  cursor: pointer;
  transition: transform 0.05s, background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
  user-select: none;
  line-height: 1.2;
  text-decoration: none;
}
.button:hover { background: var(--surface3); border-color: var(--ink); color: var(--ink); }
.button:active { transform: translateY(1px); }
.button[disabled], .button.is-loading[disabled] { opacity: 0.55; cursor: not-allowed; }

.button.is-small { padding: 0.3rem 0.6rem; font-size: 0.72rem; }
.button.is-medium { padding: 0.55rem 1rem; font-size: 0.9rem; }
.button.is-large { padding: 0.7rem 1.2rem; font-size: 1rem; }

.button.is-primary { background: var(--crt); color: var(--bg); border-color: var(--crt); }
.button.is-primary:hover { background: #16a34a; border-color: var(--crt); color: var(--bg); }
.button.is-success { background: var(--crt); color: var(--bg); border-color: var(--crt); }
.button.is-success:hover { background: #16a34a; color: var(--bg); }
.button.is-danger  { background: transparent; color: var(--danger); border-color: var(--danger); }
.button.is-danger:hover { background: var(--danger); color: var(--bg); }
.button.is-warning { background: transparent; color: var(--amber); border-color: var(--amber); }
.button.is-warning:hover { background: var(--amber); color: var(--bg); }
.button.is-info    { background: transparent; color: var(--info); border-color: var(--info); }
.button.is-info:hover { background: var(--info); color: var(--bg); }
.button.is-link    { background: transparent; color: var(--violet); border-color: var(--violet); }
.button.is-link:hover { background: var(--violet); color: var(--bg); }
.button.is-dark    { background: var(--bg); color: var(--ink); border-color: var(--edgehi); }
.button.is-dark:hover { background: var(--surface2); border-color: var(--ink); }
.button.is-light   { background: var(--surface); color: var(--ink); border-color: var(--edge); }
.button.is-light:hover { background: var(--surface2); border-color: var(--edgehi); color: var(--ink); }

/* Loading spinner inside button */
.button.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.button.is-loading::after {
  content: '';
  position: absolute;
  top: calc(50% - 7px);
  left: calc(50% - 7px);
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-color: var(--ink) var(--ink) transparent transparent;
  animation: parsh-spin 0.6s linear infinite;
  color: var(--ink);
  border-top-color: transparent;
  border-right-color: transparent;
}
@keyframes parsh-spin { to { transform: rotate(360deg); } }

.buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.buttons.are-small .button { padding: 0.3rem 0.6rem; font-size: 0.72rem; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: var(--surface2);
  color: var(--dim);
  border: 1px solid var(--edge);
  text-transform: uppercase;
  line-height: 1.4;
}
.tag.is-small { font-size: 0.62rem; padding: 0.1rem 0.4rem; }
.tag.is-light    { background: var(--surface2); color: var(--dim); border-color: var(--edge); }
.tag.is-primary  { background: transparent; color: var(--crt); border-color: var(--crtdim); }
.tag.is-info     { background: transparent; color: var(--info); border-color: var(--infodim); }
.tag.is-success  { background: var(--crt); color: var(--bg); border-color: var(--crt); }
.tag.is-warning  { background: transparent; color: var(--amber); border-color: var(--amberdim); }
.tag.is-danger   { background: var(--danger); color: var(--bg); border-color: var(--danger); }
.tag.is-dark     { background: var(--bg); color: var(--dim); border-color: var(--edgehi); }
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }

/* Icons */
.icon { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; }
.icon.is-small { width: 0.85em; height: 0.85em; }
.icon.is-left { position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--mute); }
.icon.is-right { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.icon svg { width: 1em; height: 1em; }

/* Bulma's level layout (used heavily) */
.level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.level-left, .level-right { display: flex; align-items: center; gap: 0.5rem; }
.level-item { display: flex; align-items: center; gap: 0.5rem; }
.level-right { margin-left: auto; }

/* Bulma columns */
.columns {
  display: flex;
  flex-wrap: wrap;
  margin: -0.5rem;
}
.columns.is-multiline { flex-wrap: wrap; }
.columns.is-mobile { flex-wrap: nowrap; }
.columns.is-gapless { margin: 0; }
.columns.is-gapless > .column { padding: 0; }
.column {
  flex: 1 1 0;
  padding: 0.5rem;
  min-width: 0;
}
.column.is-narrow { flex: 0 0 auto; }
.column.is-full     { flex: 0 0 100%; max-width: 100%; }
.column.is-half     { flex: 0 0 50%; max-width: 50%; }
.column.is-one-third { flex: 0 0 33.333%; max-width: 33.333%; }
.column.is-two-thirds { flex: 0 0 66.666%; max-width: 66.666%; }
.column.is-3 { flex: 0 0 25%; max-width: 25%; }
.column.is-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.column.is-6 { flex: 0 0 50%; max-width: 50%; }
.column.is-12 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 769px) {
  .column.is-half-tablet { flex: 0 0 50%; max-width: 50%; }
}
@media (min-width: 1024px) {
  .column.is-one-third-desktop { flex: 0 0 33.333%; max-width: 33.333%; }
}

/* is-flex */
.is-flex { display: flex; }
.is-align-items-center { align-items: center; }
.is-justify-content-space-between { justify-content: space-between; }
.is-fullwidth { width: 100%; }
.is-hidden { display: none !important; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal.is-active { display: flex; }
.modal-background {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
}
.modal-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--edgehi);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--edge);
  background: var(--surface2);
}
.modal-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink);
}
.modal-card-body {
  padding: 1rem;
  overflow: auto;
  background: var(--surface);
  flex: 1;
  min-height: 0;
}
.modal-card-foot {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--edge);
  background: var(--surface2);
}

/* `.delete` (modal close button) */
.delete {
  appearance: none;
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  width: 24px;
  height: 24px;
  cursor: pointer;
  position: relative;
  font-size: 0;
  padding: 0;
}
.delete::before, .delete::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 1.5px;
  background: currentColor;
  transform-origin: center;
}
.delete::before { transform: translate(-50%, -50%) rotate(45deg); }
.delete::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.delete:hover { color: var(--danger); border-color: var(--danger); }

/* File input */
.file { display: block; }
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
.file-label {
  display: flex;
  align-items: stretch;
  cursor: pointer;
  border: 1px solid var(--edge);
  background: var(--bg);
}
.file-cta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  background: var(--surface2);
  border-right: 1px solid var(--edge);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.file-cta .file-label { display: inline; padding: 0; background: transparent; border: 0; cursor: inherit; font-size: inherit; font-weight: inherit; }
.file-name {
  display: block;
  padding: 0.45rem 0.7rem;
  flex: 1;
  color: var(--dim);
  font-size: 0.78rem;
  background: var(--bg);
  word-break: break-all;
  line-height: 1.4;
}
.file-icon { width: 14px; height: 14px; }
.file:hover .file-cta { background: var(--surface3); }
.file.has-name .file-name { border-left: 0; }

/* Progress (used by Start All) */
progress.progress {
  appearance: none;
  -webkit-appearance: none;
  width: 220px;
  height: 6px;
  border: 1px solid var(--edge);
  background: var(--bg);
}
progress.progress::-webkit-progress-bar { background: var(--bg); }
progress.progress::-webkit-progress-value { background: var(--crt); }
progress.progress.is-primary::-webkit-progress-value { background: var(--crt); }
progress.progress::-moz-progress-bar { background: var(--crt); }

/* Code blocks */
code {
  background: var(--surface2);
  color: var(--crt);
  padding: 1px 5px;
  border: 1px solid var(--edge);
  font-size: 0.82em;
}
pre, code.block, .pre {
  background: var(--surface2);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--edge);
  font-size: 0.78rem;
  overflow: auto;
  display: block;
  white-space: pre-wrap;
}

/* Tooltip (used in index.html) */
.has-tooltip-arrow, .has-tooltip-multiline, .has-tooltip-right { position: relative; }
.has-tooltip-arrow:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translate(8px, -50%);
  background: var(--surface3);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 0.7rem;
  white-space: nowrap;
  border: 1px solid var(--edgehi);
  z-index: 50;
  pointer-events: none;
}

/* `.has-icons-left/right` wraps an input + absolutely-positioned icon */
.has-icons-left, .has-icons-right { position: relative; }
.has-icons-left .input { padding-left: 2rem; }
.has-icons-right .input { padding-right: 2rem; }

/* Toastify polish */
.parsh-toast {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--edgehi) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
  border-radius: 0 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.8rem !important;
  padding: 0.7rem 0.95rem !important;
  border-left-width: 3px !important;
}
.parsh-toast--ok  { border-left-color: var(--crt) !important; }
.parsh-toast--err { border-left-color: var(--danger) !important; }
.toastify-right { right: 16px !important; }

/* Utility helpers used by new templates */
.parsh-divider { border-top: 1px dashed var(--edge); margin: 0.75rem 0; }
.parsh-kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 0.9rem; align-items: baseline; font-size: 0.82rem; }
.parsh-kv dt { color: var(--dim); text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.07em; }
.parsh-kv dd { color: var(--ink); margin: 0; word-break: break-all; }

/* Dashboard-specific helpers */
.svc-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  padding: 0.85rem 0.95rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  transition: border-color 0.1s, background 0.1s;
}
.svc-card:hover { border-color: var(--edgehi); background: #161616; }
.svc-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.svc-card-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
  word-break: break-word;
  line-height: 1.25;
}
.svc-card-host {
  color: var(--dim);
  font-size: 0.72rem;
  word-break: break-all;
  cursor: pointer;
  line-height: 1.3;
}
.svc-card-host:hover { color: var(--amber); }
.svc-id-chip {
  background: var(--bg);
  border: 1px dashed var(--edge);
  color: var(--crt);
  padding: 2px 6px;
  font-size: 0.7rem;
  cursor: pointer;
  word-break: break-all;
  display: inline-block;
}
.svc-id-chip:hover { border-color: var(--crt); border-style: solid; }

/* Box header bar above each box's services */
.box-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--edge);
  border-bottom: 2px solid var(--crt);
}
.box-bar h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.box-bar h2::before {
  content: '▸';
  color: var(--crt);
  font-size: 0.85em;
}

/* Panels for TCP/UDP toggle in create_service */
.panel-selectable {
  cursor: pointer;
  border: 1px solid var(--edge);
  background: var(--surface);
  padding: 0.85rem 1rem;
  transition: border-color 0.1s, background 0.1s, box-shadow 0.1s;
  position: relative;
}
.panel-selectable:hover { border-color: var(--edgehi); }
.panel-selected {
  border-color: var(--crt) !important;
  box-shadow: inset 0 0 0 1px var(--crt);
  background: #0c1a10;
}
.panel-muted { opacity: 0.45; }
.panel-selected::before {
  content: '● SELECTED';
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--crt);
  color: var(--bg);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 2px 6px;
}

/* Lua / code preview */
.lua-preview {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--edge);
  padding: 0.6rem 0.7rem;
  color: var(--ink);
  min-height: 80px;
  word-break: break-word;
}
.lua-preview.is-clickable { cursor: text; }
.lua-preview.is-clickable:hover { border-color: var(--crt); }
.ace-box { width: 100%; height: 420px; border: 1px solid var(--edgehi); }
.lua-section-tab {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--dim);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 1rem;
  margin-bottom: -1px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.lua-section-tab:hover { color: var(--ink); background: var(--surface); }
.lua-section-tab.is-active {
  color: var(--crt);
  border-bottom-color: var(--crt);
  background: var(--surface);
}

/* rule.html bits */
.rule-card {
  border: 1px solid var(--edge);
  background: var(--surface);
  margin-bottom: 0.85rem;
}
.rule-header {
  background: var(--surface2);
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--edge);
}
.rule-content { padding: 0.85rem; }
.criterion-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
}
.criterion-card:hover { border-color: var(--edgehi); }
.negative-rule { border-left: 3px solid var(--danger); }
.positive-rule { border-left: 3px solid var(--crt); }
.output-section {
  background: var(--surface2);
  border: 1px solid var(--edge);
  padding: 0.85rem;
  margin-top: 0.85rem;
}
.template-button { background: var(--surface3); border-color: var(--edgehi); }
.action-buttons { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.collapse-button {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  cursor: pointer;
  padding: 2px 5px;
  transition: transform 0.15s ease, color 0.1s, border-color 0.1s;
}
.collapse-button:hover { color: var(--ink); border-color: var(--ink); }
.collapse-button.collapsed { transform: rotate(-90deg); }
.collapsible-content { transition: max-height 0.2s ease, opacity 0.2s; overflow: hidden; }
.collapsible-content.collapsed { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.options-inline { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.checkbox-label { font-size: 0.78rem; line-height: 1; }
.nowrap { white-space: nowrap; }

/* Content (Bulma .content) */
.content p { margin-bottom: 0.6rem; }
.content h5 { font-size: 0.95rem; margin: 0.5rem 0; color: var(--ink); }
.content h6 { font-size: 0.85rem; margin: 0.5rem 0; color: var(--ink); }

/* Form spacing helper used by edit/create_service */
.form-section { margin-bottom: 1.5rem; }
.form-section:last-child { margin-bottom: 0; }

/* Misc */
.is-clickable { cursor: pointer; }
audio { display: none; }
