/* Dashboard-only layout. Pills + most colours come from styles.css. */

body.dashboard {
  margin: 0;
  background: #11151c;
  color: #e6e6e6;
  font: 14px/1.45 -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.dash-header {
  padding: 16px 24px;
  background: #181d27;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.dash-header .dim {
  color: #9aa7bd;
  font-weight: 400;
}

.dash-header .meta {
  font-size: 12px;
  color: #aaa;
  margin-top: 2px;
}

.actions .btn-link {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(120, 160, 230, 0.18);
  color: #cde;
  border: 1px solid rgba(120, 160, 230, 0.4);
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
}

.actions .btn-link:hover {
  background: rgba(120, 160, 230, 0.32);
}

.stats-row {
  display: grid;
  grid-template-columns: 160px repeat(3, 1fr);
  gap: 12px;
  padding: 16px 24px;
}

.stat {
  background: #1c222d;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 14px;
}

.stat.big {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 11px;
  color: #8aa;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: #fff;
}

/* Phase H2: secondary "n=N" subtext under a KPI tile to flag small
   sample sizes (don't trust mean of three data points). */
.stat-sub {
  margin-top: 2px;
  font-size: 10px;
  color: #8a98ae;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.04em;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-row .pill {
  font-size: 11px;
  padding: 2px 8px;
}

.pill-row .pill .n {
  font-weight: 700;
  margin-left: 4px;
}

.filter-card {
  margin: 0 24px 16px;
  background: #1c222d;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 16px;
}

.filter-card h2 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #8aa;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-row label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #aac;
  gap: 4px;
}

.filter-row input,
.filter-row select {
  min-width: 140px;
}

.table-card {
  margin: 0 24px 24px;
  background: #1c222d;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.table-card header {
  padding: 10px 14px;
  background: #232a37;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #aac;
  display: flex;
  justify-content: space-between;
}

.table-card header .dim {
  color: #9aa7bd;
  text-transform: none;
  letter-spacing: 0;
}

#wo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#wo-table th,
#wo-table td {
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

#wo-table thead th {
  font-size: 11px;
  color: #8aa;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: rgba(0, 0, 0, 0.2);
}

#wo-table tbody tr {
  cursor: pointer;
}

#wo-table tbody tr:hover {
  background: rgba(120, 160, 230, 0.08);
}

#wo-table .entity-link {
  color: #9ad;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 11px;
}

#wo-table .ts {
  font-size: 11px;
  color: #a8b3c4;
  font-family: ui-monospace, "Cascadia Mono", monospace;
}

#wo-empty {
  padding: 20px;
  text-align: center;
  font-style: italic;
  color: #8a98ae;
}

#wo-table .row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

#wo-table .row-actions .icon-btn {
  padding: 3px 8px;
  font-size: 11px;
  color: #aaa;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  cursor: pointer;
}

#wo-table .row-actions .icon-btn:hover {
  background: rgba(120, 160, 230, 0.2);
  color: #fff;
  border-color: rgba(120, 160, 230, 0.5);
}

#wo-table .row-actions .icon-btn.danger:hover {
  background: rgba(180, 50, 50, 0.5);
  border-color: rgba(220, 60, 60, 0.6);
}

/* ----- modal ----- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Browser's default for [hidden] is display:none, but our `display: flex`
   rule would override it; opt-in here so toggling .hidden actually hides. */
.modal-backdrop:not([hidden]) {
  display: flex;
}

.modal {
  background: #1c222d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0;
  width: min(520px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-head {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #aac;
}

.modal-head .icon-btn {
  font-size: 18px;
  line-height: 1;
  padding: 2px 8px;
  color: #aaa;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.modal-head .icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
}

.modal-body .ff {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #aac;
  margin-bottom: 10px;
}

.modal-body .ff-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-body .ff-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #aac;
  flex: 1;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  background: rgba(255, 255, 255, 0.06);
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.modal-body textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.modal-foot .error-text {
  margin-right: auto;
  color: #f88;
  font-size: 11px;
}

.modal-foot button {
  background: rgba(255, 255, 255, 0.06);
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}

.modal-foot button.primary {
  background: rgba(120, 160, 230, 0.3);
  border-color: rgba(120, 160, 230, 0.6);
  color: #cde;
}

.modal-foot button:hover:not(:disabled) {
  background: rgba(120, 160, 230, 0.4);
}

.modal-foot button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
