/* Operations (module operations): app skin. Rules moved verbatim from styles.css (C1); the variables are the app identity, posture themes re-map the shell only. */
/* P9 scheme tokens: light = the colours these rules always used, dark = the shell's dark surfaces. */
:root {
  --ops-surface: #fff;
  --ops-surface-2: #f8f9fa;
  --ops-surface-3: #f1f3f5;
}
[data-scheme="dark"] {
  --ops-surface: #1a1e23;
  --ops-surface-2: #232324;
  --ops-surface-3: #28292b;
}
.module-body[data-module="operations"] {
  --app-font: "Inter", "Open Sans", Arial, sans-serif;
  --app-accent: #1e4f8a;
  --app-bg: #f8f9fa;
  --app-surface: #ffffff;
  --app-radius: 6px;
}

/* ---------- Operations ---------- */
.ops-layout { display: flex; flex-direction: column; gap: 14px; }
.ops-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.stat-card { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; }
.stat-card.is-active { border-color: var(--border-strong); background: var(--surface-2); }
.stat-card strong { display: block; font-size: 24px; letter-spacing: -0.02em; margin-top: 2px; }
.ops-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-chip { padding: 6px 10px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.filter-chip:hover { color: var(--text); }
.filter-chip.is-active { color: var(--accent-contrast); background: var(--accent); border-color: transparent; font-weight: 600; }
.filter-chip span { opacity: 0.75; margin-left: 3px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
.ticket-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.ticket-table th { text-align: left; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 10px 13px; border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.ticket-table td { padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: top; }
.ticket-table tr:last-child td { border-bottom: none; }
.ticket-table tr:hover td { background: var(--surface-2); }
.ticket-table td strong { display: block; font-size: 12.5px; font-weight: 600; }
.ticket-table td small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; max-width: 44ch; }
.pill { display: inline-block; padding: 2px 7px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 999px; border: 1px solid var(--border-strong); }
.priority-critical { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.priority-high { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.priority-medium { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.priority-low { color: var(--muted); }
.status-open { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.status-triage { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.status-closed { color: var(--ok); background: rgba(99, 214, 154, 0.12); border-color: transparent; }

@media (max-width: 900px) {
  .ops-summary { grid-template-columns: repeat(2, minmax(0, 1fr));  }
}
/* ---------- Operations / Timeline ---------- */
.ticket-table th { background: var(--ops-surface-2); }
.stat-card { background: var(--ops-surface); }
.stat-card.is-active { background: var(--ops-surface-3); }

/* Plan B Task 3: the author-from-inject chip and the linked content panel of an inject */
.prefill-chip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 16px 0; padding: 6px 10px; border-radius: 8px; border: 1px solid currentColor; font-size: 13px; }
.inject-linked { padding: 8px 4px; display: grid; gap: 8px; }
.inject-author { display: flex; flex-wrap: wrap; gap: 6px; }
.inject-linked ul { margin: 0; padding-left: 16px; }
.inject-linked li { margin: 2px 0; }

/* Plan B Task 5: MSEL import/export and the dry-run view */
.inject-problems { color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 8px 8px 8px 24px; margin: 8px 0; }
.inject-problems li { margin: 2px 0; }
.inject-order { padding-left: 20px; margin: 8px 0; }
.inject-order li { margin: 4px 0; }
.inject-import { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }

/* --- C10 Operations: new ticket form, SLA age, ticket drawer with status, assignee and comment thread */
.ticket-new { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; }
.ticket-new > summary { display: inline-flex; align-items: center; gap: 6px; margin: 10px; list-style: none; cursor: pointer; }
.ticket-new > summary::-webkit-details-marker { display: none; }
.ticket-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 12px 12px; }
.ticket-form label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); }
.ticket-form input, .ticket-form select, .ticket-form textarea, .ticket-assign select, .ticket-comment-form textarea { font: inherit; font-size: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.ticket-form .span-2 { grid-column: span 2; }
.ticket-form > .btn { justify-self: start; align-self: end; }
.ops-note { font-size: 11px; color: var(--faint); margin: 0; }
.ops-main { display: grid; gap: 14px; align-items: start; }
.ops-main.has-drawer { grid-template-columns: minmax(0, 1fr) 340px; }
.ticket-row { cursor: pointer; }
.ticket-row.is-active td { background: var(--surface-2); }
.ticket-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ticket-table td.sla { white-space: nowrap; }
.sla-late { color: var(--danger); font-weight: 600; }
.ticket-table td.sla small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.ticket-drawer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; position: sticky; top: 12px; }
.drawer-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.drawer-head h3 { margin: 2px 0 0; font-size: 14px; }
.drawer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; font-size: 11.5px; }
.drawer-meta dt { color: var(--faint); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.drawer-meta dd { margin: 2px 0 0; color: var(--text); }
.drawer-summary { font-size: 12px; color: var(--muted); margin: 0; }
.drawer-status { display: flex; gap: 5px; flex-wrap: wrap; }
.ticket-assign { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.ticket-assign label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); flex: 1 1 160px; }
.ticket-thread h4 { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.ticket-thread ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.ticket-comment { padding: 7px 9px; background: var(--surface-2); border-radius: 8px; }
.ticket-comment.is-self { border-left: 2px solid var(--accent); }
.ticket-comment small { font-size: 10px; color: var(--faint); }
.ticket-comment p { margin: 3px 0 0; font-size: 12px; white-space: pre-wrap; }
.ticket-comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.ticket-comment-form textarea { width: 100%; resize: vertical; }
@media (max-width: 900px) {
  .ops-main.has-drawer { grid-template-columns: minmax(0, 1fr); }
  .ticket-drawer { position: static; }
}
@media (max-width: 720px) {
  .ticket-form { grid-template-columns: minmax(0, 1fr); }
  .ticket-form .span-2 { grid-column: auto; }
  .ops-toolbar { gap: 8px; }
  .drawer-meta { grid-template-columns: minmax(0, 1fr); }
}

/* P9 dark scheme: the module tokens above, the shell's dark surfaces */
[data-scheme="dark"] .module-body[data-module="operations"] {
  --app-accent: #73a1dc;
  --app-bg: #232324;
  --app-surface: #1a1e23;
}
