/* Notice, EmptyState, MetadataGrid, EventTimeline, UsageMeter and
 * ContractPreview from the Sendplane design system, plus the imported
 * dashboard's layout utilities restyled on the same tokens. */

/* ─── Notice: a fact first, then its consequence ─────────────── */
.notice {
  display: block;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-callout);
  color: var(--info-fg);
  background: var(--info-bg);
  font-size: 13px;
  line-height: 1.5;
}
.notice:has(> svg) { display: flex; align-items: flex-start; gap: 12px; }
.page-header + .notice { margin-top: -12px; }
.notice > svg { width: 18px; height: 18px; color: var(--accent); }
.notice p { margin: 0; line-height: 1.5; }
.notice p + p { margin-top: 6px; }
.notice-success { border-color: var(--success-border); color: var(--success-fg); background: var(--success-bg); }
.notice-warning { border-color: var(--warning-border); color: var(--warning-fg); background: var(--warning-bg); }
.notice-danger { border-color: var(--danger-border); color: var(--danger-fg); background: var(--danger-bg); }
.notice .notice-actions, .notice > .button { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.notice > .button { display: inline-flex; }

/* ─── Empty state: what is missing, then the next step ───────── */
.empty, .empty-state { display: grid; justify-items: center; padding: 56px 20px; color: var(--muted); text-align: center; }
.empty > svg, .empty-state > svg { width: 24px; height: 24px; margin-bottom: 12px; color: var(--quiet); }
.empty h2, .empty-state h2, .empty-state-title { margin-bottom: 6px; color: var(--ink); font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.empty p, .empty-state p, .empty-state-text { max-width: 420px; margin: 0; color: var(--muted); }
.empty > .status { margin-bottom: 12px; }
.empty > .button, .empty-state > .button, .empty > .btn, .empty-state > .btn { margin-top: 18px; }
.empty > p + p { margin-top: 6px; }
.empty-state-icon { margin-bottom: 12px; color: var(--quiet); font-size: 24px; }

/* ─── MetadataGrid: labelled values in two columns ───────────── */
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.metadata-grid > div { min-width: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
/* The last row loses its rule; a full-width item after it keeps the rule above it. */
.metadata-grid > div:nth-last-child(-n + 2):not(.metadata-span):not(:has(~ .metadata-span)), .metadata-grid > div:last-child { border-bottom: 0; }
.metadata-grid > div:nth-child(odd):not(.metadata-span) { border-right: 1px solid var(--line); }
.metadata-grid .metadata-span { grid-column: 1 / -1; border-right: 0; }
.metadata-grid dt { margin-bottom: 7px; color: var(--quiet); font-size: 10px; font-weight: 680; letter-spacing: .045em; text-transform: uppercase; }
.metadata-grid dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; line-height: 1.5; }
.metadata-grid code { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─── EventTimeline: recorded events in order ────────────────── */
.event-timeline { margin: 0; padding: 8px 20px 14px; list-style: none; }
.event-timeline li { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 11px; padding: 12px 0; }
.event-timeline li:not(:last-child)::before { content: ""; position: absolute; top: 25px; bottom: -13px; left: 7px; width: 1px; background: var(--line); }
.timeline-marker { position: relative; z-index: 1; width: 9px; height: 9px; margin: 4px 0 0 3px; border: 2px solid var(--surface); border-radius: var(--radius-round); background: var(--quiet); box-shadow: 0 0 0 1px var(--line); }
.timeline-marker-success { background: var(--success-fg); box-shadow: 0 0 0 1px var(--success-border); }
.timeline-marker-warning { background: var(--warning-fg); box-shadow: 0 0 0 1px var(--warning-border); }
.timeline-marker-danger { background: var(--danger-fg); box-shadow: 0 0 0 1px var(--danger-border); }
.timeline-card { min-width: 0; }
.timeline-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.timeline-card header > div { min-width: 0; display: grid; gap: 3px; }
.timeline-card strong { font-size: 13px; }
.timeline-card small, .timeline-card time, .timeline-card p { color: var(--muted); font-size: 11px; }
.timeline-card time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.timeline-card p { margin: 7px 0 0; }
.timeline-card p:empty { display: none; }

/* ─── UsageMeter: a count against its limit ──────────────────── */
.usage-list { display: grid; }
.usage-list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.usage-row { min-width: 0; min-height: 76px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, .8fr); align-items: center; gap: 24px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.usage-row:last-child { border-bottom: 0; }
.usage-list-grid .usage-row:nth-child(odd) { border-right: 1px solid var(--line); }
.usage-list-grid .usage-row:nth-last-child(-n + 2) { border-bottom: 0; }
.usage-row > div:first-child { min-width: 0; display: grid; gap: 4px; }
.usage-row strong { font-size: 13px; }
.usage-row small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.usage-meter { min-width: 0; display: grid; gap: 8px; justify-items: end; text-align: right; }
.usage-meter > span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.usage-meter progress { width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: var(--radius-pill); color: var(--accent); background: var(--surface-inset); appearance: none; }
.usage-meter progress::-webkit-progress-bar { border-radius: inherit; background: var(--surface-inset); }
.usage-meter progress::-webkit-progress-value { border-radius: inherit; background: var(--accent); }
.usage-meter progress::-moz-progress-bar { border-radius: inherit; background: var(--accent); }

/* ─── ContractPreview: what a change will do, before it happens ─ */
.contract-preview { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--muted); background: var(--canvas); font-size: 12px; }
.contract-preview > strong { color: var(--ink); font-size: 12px; }
.contract-preview p { margin: 0; }
.contract-preview-warning { border-color: var(--warning-border); color: var(--warning-fg); background: var(--warning-bg); }
.contract-preview-warning > strong, .contract-preview-warning p strong { color: var(--warning-fg); }
.contract-preview-danger { border-color: var(--danger-border); color: var(--danger-fg); background: var(--danger-bg); }
.contract-preview-danger > strong { color: var(--danger); }

/* ─── Imported layout utilities ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* The imported settings tabs follow Sendplane's SettingsNavigation. */
.settings-tabs { display: flex; gap: 5px; margin-bottom: 24px; padding-bottom: 1px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.settings-tab {
  position: relative;
  min-width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-control) var(--radius-control) 0 0;
  color: var(--muted);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 580;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.settings-tab.active { color: var(--fg-primary); background: var(--interactive-selected); font-weight: 680; }
.settings-tab.active::after { content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }

/* The imported segmented control follows the compact ThemePicker. */
.segmented-control { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border-subtle); border-radius: var(--radius-control); background: var(--surface-inset); }
.segmented-control .btn { min-height: 29px; padding: 0 10px; border: 0; border-radius: var(--radius-code); color: var(--muted); background: transparent; box-shadow: none; font-size: 12px; }
.segmented-control .btn-primary { color: var(--fg-primary); background: var(--surface-elevated); box-shadow: var(--shadow-segment); }

/* Loading placeholder: a quiet fill that breathes. */
.skeleton { border-radius: var(--radius-tag); background: var(--soft); animation: skeleton-breathe 1.6s ease-in-out infinite; }
@keyframes skeleton-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.content-preview { color: var(--ink); max-height: 300px; overflow-y: auto; padding: var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-control); background: var(--soft); font-size: 13px; line-height: 1.6; }
/* A small uppercase label above a group (the design system's micro-label). */
.section-label { margin-bottom: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-subtle); color: var(--quiet); font-size: 10px; font-weight: 680; letter-spacing: .045em; text-transform: uppercase; }

.agent-dot-active { position: relative; width: 8px; height: 8px; border-radius: var(--radius-round); background: var(--success); animation: status-pulse 2s ease-in-out infinite; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.w-full { width: 100%; }

@media (hover: hover) and (pointer: fine) {
  .settings-tab:hover { color: var(--ink); background: var(--soft); }
}

@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .metadata-grid { grid-template-columns: 1fr; }
  .metadata-grid > div, .metadata-grid > div:nth-child(odd):not(.metadata-span) { grid-column: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .metadata-grid > div:last-child { border-bottom: 0; }
  .timeline-card header { display: grid; gap: 5px; }
  .usage-list-grid { grid-template-columns: 1fr; }
  .usage-list-grid .usage-row:nth-child(odd) { border-right: 0; }
  .usage-list-grid .usage-row:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .usage-list-grid .usage-row:last-child { border-bottom: 0; }
  .usage-row { grid-template-columns: 1fr; gap: 10px; }
  .usage-meter { justify-items: start; text-align: left; }
}
