/* admin.css — the Green Trust admin area (/admin), Phase 2 worker 2C.
 * Its own rules only (handbook §4.0): the Home (ct-ah-*), the parts the admin
 * records share (ct-adm-*: the decision row and forms, the versions, the
 * matches to check, the activity's technical record). Colours come from the
 * tokens (tokens.css; dark.css flips them), never a hex value here. The list
 * bar, the record skeleton and the phone kit are kit.css / phone-kit.css. */

/* ═══════════════ the list bar ═══════════════ */

/* "There is no box around the bar" (handbook §2.2, EUDR's DDS Cases bar):
   ui.css's .ct-toolbar draws one. Overridden for the admin's lists here;
   P3 folds it back into kit.css. */
body[data-shell="admin"] .ct-list-bar {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

/* ═══════════════ the Home (pages/ops-home.js) ═══════════════ */

.ct-main > #page-root.ct-admin-homepage {
  max-width: none;
  display: flex;
  flex-direction: column;
}
.ct-ah {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 2px 4px;
}

/* The greeting band: Storm in both themes, so its ink is the chrome ramp. */
.ct-ah-welcome {
  background:
    radial-gradient(60% 170% at 100% 0%, rgb(var(--cyan-rgb) / 0.18), transparent 62%),
    linear-gradient(135deg, var(--brand-storm) 0%, var(--storm-lift) 55%, var(--storm-lift-3) 100%);
  border-radius: var(--radius-fluid);
  padding: 12px 20px;
  box-shadow: 0 6px 24px rgb(var(--storm-rgb) / 0.22);
}
.ct-ah-welcome-name {
  margin: 0 0 2px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--chrome-ink);
}
.ct-ah-welcome-greeting {
  color: var(--chrome-sec);
  font-weight: 400;
}
.ct-ah-welcome-name .ct-help-tip {
  color: var(--chrome-ink);
  margin-inline-start: 6px;
}
.ct-ah-welcome-date {
  margin: 0;
  font-size: 0.76rem;
  color: var(--chrome-dim);
}

/* Figures: the words on top, the number, its state line (EUDR
   AdminHomeTab.js:148-150: no icon square, no tinted border). */
.ct-ah-figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ct-ah-figure {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px 12px;
  border-radius: var(--radius-glass);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
}
a.ct-ah-figure {
  transition: transform var(--transition), box-shadow var(--transition);
}
a.ct-ah-figure:hover {
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-md);
}
a.ct-ah-figure:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ct-ah-figure-label {
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-muted);
}
.ct-ah-figure-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.ct-ah-figure-sub {
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--text-muted);
}
.ct-ah-figure--warn .ct-ah-figure-value {
  color: var(--warning);
}

/* The Home's skeleton: the only skeleton (handbook §1). */
.ct-ah-figure--skeleton {
  min-height: 92px;
}
.ct-ah-bone {
  display: block;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.ct-ah-bone--label { width: 55%; height: 12px; }
.ct-ah-bone--value { width: 30%; height: 28px; margin: 4px 0; }
.ct-ah-bone--sub { width: 70%; height: 10px; }

/* The decisions card takes the map's space; the activity card beside it. */
.ct-ah-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.ct-ah-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--page-card);
  box-shadow: inset 0 0 0 1px var(--page-card-edge), var(--page-card-shadow);
}
.ct-ah-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ct-ah-card-head--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ct-ah-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.ct-ah-card-title svg {
  flex: none;
  color: var(--accent);
}
.ct-ah-card-sub,
.ct-ah-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-ah-card-link,
.ct-ah-more a {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--link);
}
.ct-ah-more {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-ah-card .ct-table td.ct-ah-work {
  width: 1%;
  white-space: nowrap;
}

/* Recent activity: a dot for how much it matters, the words, "5 min ago · who". */
.ct-ah-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-ah-feed-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ct-ah-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--ok);
}
.ct-ah-dot--warning { background: var(--warning); }
.ct-ah-dot--danger { background: var(--danger); }
.ct-ah-feed-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ct-ah-feed-what {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ct-ah-feed-when {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .ct-ah-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-ah-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ═══════════════ records: the decision row and its forms ═══════════════ */

/* The discreet figure in a record's meta line (what the sheet declares
   against the limit; the CMR outcome). */
.ct-adm-figure {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* Quiet actions on the left, the ones that change the verdict apart on the
   right (EUDR PlotAssessmentHistory.js:458-479). */
.ct-adm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.ct-adm-actions-quiet,
.ct-adm-actions-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ct-adm-actions-verdict {
  margin-inline-start: auto;
}
.ct-adm-actions-quiet:empty,
.ct-adm-actions-verdict:empty {
  display: none;
}

.ct-adm-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.ct-adm-form-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--text);
}
.ct-adm-form-intro {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-adm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ct-adm-field label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
}
.ct-adm-req {
  font-weight: 400;
  color: var(--text-muted);
}
.ct-adm-input {
  width: 100%;
  max-width: 640px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.ct-adm-input--short {
  max-width: 140px;
}
.ct-adm-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.ct-adm-counter {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.ct-adm-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
/* The one plain reason the button may not be sent yet, beside it. */
.ct-adm-form-why {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--warning);
}
.ct-adm-form-why[hidden] {
  display: none;
}
.ct-adm-form [aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

/* ═══════════════ records: the versions ═══════════════ */

.ct-record-section-title .ct-seg-n {
  margin-inline-start: 8px;
  vertical-align: middle;
}
.ct-adm-history {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--border);
}
.ct-adm-history-row {
  padding: 10px 14px;
}
.ct-adm-history-row + .ct-adm-history-row {
  border-top: 1px solid var(--border);
}
.ct-adm-history-row.is-latest {
  background: var(--primary-soft);
}
.ct-adm-history-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.ct-adm-history-main,
.ct-adm-history-side {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: var(--text-sm);
}
.ct-adm-history-how {
  color: var(--text-muted);
}
.ct-adm-latest {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: var(--text-xs);
  font-weight: 800;
}
.ct-adm-history-toggle,
.ct-adm-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}
.ct-adm-history-toggle {
  margin-top: 4px;
}
.ct-adm-history-toggle:hover,
.ct-adm-linkbtn:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
.ct-adm-history-reason {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ═══════════════ a supplier's matches to check ═══════════════ */

.ct-adm-check-group + .ct-adm-check-group {
  margin-top: 18px;
}
.ct-adm-check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}
.ct-adm-check-head p {
  margin: 2px 0 0;
  font-size: var(--text-sm);
}
.ct-adm-checks td:first-child {
  width: 1%;
  white-space: nowrap;
}
.ct-adm-check-detail td {
  background: var(--surface-2);
}
.ct-adm-check-facts {
  margin-bottom: 10px;
}

/* ═══════════════ the activity log ═══════════════ */

.ct-activity-count.ct-seg-n {
  margin-inline: 6px;
}
.ct-adm-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.ct-adm-details .ct-activity-detail {
  overflow-wrap: anywhere;
}
.ct-adm-tech {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 10px;
  margin: 2px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-xs);
}
.ct-adm-tech > div {
  display: contents;
}
.ct-adm-tech dt {
  color: var(--text-muted);
}
.ct-adm-tech dd {
  margin: 0;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ct-adm-search-note {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-activity-table td.ct-activity-time {
  white-space: nowrap;
}

/* ═══════════════ System ═══════════════ */

.ct-adm-panel .ct-note-slot {
  margin-bottom: 8px;
}
.ct-adm-mail-body {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ═══════════════ the phone (body.ct-ph ≤600px) ═══════════════ */

@media (max-width: 600px) {
  body.ct-ph .ct-adm-ph-body .ph-seg {
    margin-bottom: 4px;
  }
  body.ct-ph .ph-screen .ct-note-slot:not([hidden]) {
    margin: 8px 16px 0;
  }
  body.ct-ph .ph-screen .ct-adm-form-why {
    margin: 6px 16px 0;
  }
  /* a record's hero: the verdict word and its figure wrap rather than run
     off the card */
  body.ct-ph #page-root .ph-hero-line {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  body.ct-ph .ph-grp .ct-adm-mail-body {
    margin: 0;
    padding: 12px 16px;
    font-size: 15px;
  }
}

/* New registrations waiting for Green Trust's approval (questionnaire Q43). */
.ct-ah-card--signups { margin-bottom: 16px; }
.ct-ah-signup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border, rgba(0,0,0,.08)); }
.ct-ah-signup-actions { display: flex; gap: 8px; }
.ct-ah-signup .ct-note-slot { flex-basis: 100%; }
