.operations-mode {
  background: #0b1220;
  --bg: #0b1220;
  --panel: #0f1724;
  --panel-2: #111c2e;
  --text: #eef5ff;
  --muted: #9fb0c8;
  --line: #26344a;
  --line-strong: #475569;
  --shadow: none;
}

.operations-mode .main {
  background: #0b1220;
}

.operations-mode .topbar {
  margin-bottom: 14px;
}

.operations-mode .summary-grid {
  display: none;
}

.operations-mode .top-actions {
  display: flex;
}

.operations-mode .search,
.operations-mode #compactBtn {
  display: none;
}

.operations-mode .workspace {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.operations-mode .section-head {
  display: none;
}

.operations-mode #pageSubtitle,
.operations-mode #sectionHint {
  color: #a9b8cd;
}

.operations-mode .nav .count {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.workspace,
.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px;
}

.metric .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 950;
}

.metric .note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.workspace,
.detail {
  padding: 16px;
}

.section-head,
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.view-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-2);
}

.tab {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  background: var(--panel);
  color: var(--text);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.native-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.native-panel[hidden] {
  display: none;
}

.module-loading-panel {
  min-height: min(620px, calc(100vh - 150px));
}

.module-loading-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.module-loading-grid span,
.module-loading-line {
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148, 163, 184, .18), rgba(148, 163, 184, .34), rgba(148, 163, 184, .18));
  background-size: 220% 100%;
  animation: module-loading-pulse 1.4s ease-in-out infinite;
}

.module-loading-grid span {
  height: 86px;
}

.module-loading-line {
  height: 15px;
  margin-top: 16px;
}

.module-loading-line.short {
  width: 68%;
  margin-top: 10px;
}

@keyframes module-loading-pulse {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.native-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
}

.native-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
}

.native-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  display: grid;
  gap: 12px;
  min-height: 184px;
}

.home-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.home-card h3 {
  margin: 0;
  font-size: 17px;
}

.home-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 6px;
}

.home-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.home-go {
  align-self: end;
  width: 100%;
}

.home-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-strip div {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 10px;
}

.home-strip strong {
  display: block;
  font-size: 22px;
}

.home-strip span {
  color: var(--muted);
  font-size: 12px;
}

.status-details summary {
  cursor: pointer;
  font-weight: 900;
}

.status-details summary + .native-muted {
  margin-top: 8px;
}

.native-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.secretary-toolbar,
.command-row,
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.secretary-toolbar {
  justify-content: space-between;
}

.pill-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-tab {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.pill-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.kanban-mini {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-col {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 10px;
}

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 950;
}

.task-mini {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.task-mini.in_progress {
  border-left-color: #f59e0b;
}

.task-mini.done {
  border-left-color: #1d7f4f;
}

.task-mini.todo {
  border-left-color: var(--accent);
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.task-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mini-select,
.mini-input,
.mini-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 9px;
  font-size: 13px;
}

.mini-textarea {
  min-height: 82px;
  resize: vertical;
}

.command-row .mini-input {
  flex: 1;
  min-width: 220px;
}

.task-form-grid,
.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.task-form-grid .wide,
.control-grid .wide {
  grid-column: 1 / -1;
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #e6ebf1;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.ai-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px;
  min-height: 174px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card.compact {
  min-height: 128px;
  gap: 8px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-weight: 950;
  line-height: 1.35;
}

.card-desc {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  flex: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.live {
  background: #e9f7ef;
  color: var(--success);
  border-color: #bfe8cf;
}

.badge.archive {
  background: #fff6e5;
  color: var(--warning);
  border-color: #f3d49b;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

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

.btn:hover {
  border-color: var(--line-strong);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: var(--panel-2);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail {
  margin-top: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  margin-bottom: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.detail-box.wide {
  grid-column: 1 / -1;
}

.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 6px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

body.compact .card {
  min-height: 126px;
}

body.compact .card-desc {
  display: none;
}

.toast {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: #174ea6;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 750;
}

.global-toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 520;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.global-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  border: 1px solid #d6e4d6;
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  color: #24364a;
  padding: 12px 12px;
  box-shadow: 0 18px 48px rgba(55, 67, 88, .16);
  animation: toastIn .18s ease-out;
  backdrop-filter: blur(12px);
}

.global-toast.info {
  border-color: #d8e1ee;
}

.global-toast.error {
  border-color: #f0c7bf;
}

.global-toast-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: #6fa583;
  box-shadow: 0 0 0 4px rgba(111, 165, 131, .14);
}

.global-toast.info .global-toast-dot {
  background: #7d94ad;
  box-shadow: 0 0 0 4px rgba(125, 148, 173, .14);
}

.global-toast.error .global-toast-dot {
  background: #b95d4f;
  box-shadow: 0 0 0 4px rgba(185, 93, 79, .14);
}

.global-toast-copy {
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
  word-break: break-word;
}

.global-toast button {
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #7b8794;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.global-toast button:hover {
  border-color: #d8e1ee;
  background: #f6f8fb;
  color: #24364a;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-dark .global-toast {
  border-color: rgba(148, 163, 184, .28);
  background: rgba(16, 24, 39, .96);
  color: #e5edf7;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .3);
}

.theme-dark .global-toast button {
  color: #a8b3c2;
}

.theme-dark .global-toast button:hover {
  border-color: rgba(148, 163, 184, .32);
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--muted);
  font-size: 12px;
}

.list-pagination-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.list-pagination-meta strong {
  color: var(--ink);
  font-weight: 850;
}

.list-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.list-pagination-size {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.list-pagination .btn[disabled] {
  cursor: not-allowed;
  opacity: .45;
}

@media (max-width: 720px) {
  .list-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .list-pagination-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .list-pagination-controls .btn,
  .list-pagination-size {
    width: 100%;
  }

  .list-pagination-size {
    grid-column: 1 / -1;
  }
}
