/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   COMPONENTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
  height: 38px;
  transition: background var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--ink);
  color: var(--light);
}

.btn-primary:hover {
  background: #2a2a28;
  box-shadow: var(--shadow-sm);
}

.btn-published {
  background: var(--status-published-bg);
  color: var(--status-published);
  border: 1px solid var(--status-published);
}

.btn-published:hover {
  background: var(--status-published);
  color: #fff;
}

.btn-approve {
  background: var(--status-approved);
  color: #fff;
  box-shadow: 0 2px 8px rgba(34, 139, 34, 0.25);
}

.btn-approve:hover {
  background: oklch(38% 0.16 155);
  box-shadow: 0 4px 14px rgba(34, 139, 34, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--ink);
  border: 1px solid var(--ink-faint);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-mid);
  border: 1px solid var(--ink-faint);
}

.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-faint);
}

.btn-danger:hover {
  background: var(--accent-faint);
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: 9px;
}

.btn-lg {
  height: 46px;
  padding: 0 var(--space-8);
  font-size: 11px;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Status Badge ── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--fd);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 3px 8px 3px 6px;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}
.status-pending::before { background: var(--status-pending); }

.status-approved {
  background: var(--status-approved-bg);
  color: var(--status-approved);
}
.status-approved::before { background: var(--status-approved); }

.status-adjustment {
  background: var(--status-adjustment-bg);
  color: var(--status-adjustment);
}
.status-adjustment::before { background: var(--status-adjustment); }

.status-awaiting {
  background: var(--status-awaiting-bg);
  color: var(--status-awaiting);
}
.status-awaiting::before { background: var(--status-awaiting); }

.status-published {
  background: var(--status-published-bg);
  color: var(--status-published);
}
.status-published::before { background: var(--status-published); }

/* ── Post Card ── */

.post-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
  text-align: left;
  width: 100%;
}

.post-card:hover {
  background: var(--bg-alt);
  border-color: rgba(12,12,10,0.14);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.post-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-alt);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.post-thumb-placeholder {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--ink-faint);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mid);
  overflow: hidden;
  position: relative;
}

.post-thumb-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
}

.post-thumb-placeholder svg { width: 18px; height: 18px; opacity: 0.25; }

.post-type-icon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(12,12,10,0.6);
  border-radius: 3px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-type-icon svg { width: 10px; height: 10px; color: #fff; }

.post-info {
  flex: 1;
  min-width: 0;
}

.post-name {
  font-family: var(--fd);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-meta {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-faint);
  border: 1px solid currentColor;
  flex-shrink: 0;
}

.post-card-arrow {
  color: var(--ink-mid);
  opacity: 0;
  transition: opacity var(--duration), transform var(--duration);
  flex-shrink: 0;
}

.post-card:hover .post-card-arrow {
  opacity: 1;
  transform: translateX(2px);
}
.post-card-arrow svg { width: 16px; height: 16px; }

/* ── Metric Card ── */

.metric-card {
  background: var(--bg);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: box-shadow var(--duration), transform var(--duration);
}

.metric-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.metric-value {
  font-family: var(--fd);
  font-weight: 700;
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}

.metric-label {
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.metric-delta {
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}

.metric-delta.up   { color: var(--status-approved); }
.metric-delta.down { color: var(--accent); }

/* ── Alert Banner ── */

.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: oklch(52% 0.17 62 / 0.07);
  border: 1px solid oklch(52% 0.17 62 / 0.2);
  border-left: 3px solid var(--status-adjustment);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  animation: slideUp var(--duration-md) var(--ease-out) both;
}

.alert-banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.alert-banner-icon {
  color: var(--status-adjustment);
  flex-shrink: 0;
}

.alert-banner-icon svg { width: 16px; height: 16px; }

.alert-banner-text {
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.alert-banner-sub {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin-top: 2px;
  font-weight: 300;
}

/* ── Filters ── */

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.filter-btn {
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: 99px;
  font-family: var(--fd);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mid);
  background: transparent;
  border: 1px solid var(--ink-faint);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.filter-btn.active {
  background: var(--ink);
  color: var(--light);
  border-color: var(--ink);
}

/* ── Contract Item ── */

.contract-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5);
  background: var(--bg);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-lg);
  transition: background var(--duration), box-shadow var(--duration);
}

.contract-item:hover {
  background: var(--bg-alt);
  box-shadow: var(--shadow-sm);
}

.contract-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-mid);
}

.contract-icon svg { width: 18px; height: 18px; }

.contract-info { flex: 1; min-width: 0; }

.contract-name {
  font-family: var(--fd);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.contract-meta {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Toast ── */

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--dark);
  color: var(--light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  pointer-events: auto;
  animation: slideInRight var(--duration-md) var(--ease-out) both;
  max-width: 320px;
  border: 1px solid var(--dark-border);
}

.toast-icon { flex-shrink: 0; }
.toast-icon svg { width: 14px; height: 14px; }
.toast.toast-success .toast-icon { color: var(--status-approved); }
.toast.toast-error   .toast-icon { color: var(--accent-on-dark); }
.toast.toast-info    .toast-icon { color: var(--light-mid); }

.toast.removing {
  animation: slideInRight var(--duration) var(--ease-in) reverse both;
}

/* ── Form elements ── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--fb);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--ink);
  transition: border-color var(--duration), box-shadow var(--duration);
  outline: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-mid);
  opacity: 0.5;
}

.form-input:focus,
.form-textarea:focus {
  border-color: rgba(12,12,10,0.3);
  box-shadow: 0 0 0 3px var(--ink-xfaint);
}

.form-textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

select.form-input {
  -webkit-appearance: auto;
  appearance: auto;
  cursor: pointer;
}

/* ── Divider ── */

.divider {
  height: 1px;
  background: var(--ink-faint);
  margin: var(--space-6) 0;
}

/* ── Empty state ── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  gap: var(--space-4);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--ink-mid);
  opacity: 0.3;
}

.empty-state-title {
  font-family: var(--fd);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.empty-state-text {
  font-size: var(--text-base);
  color: var(--ink-mid);
  font-weight: 300;
  max-width: 32ch;
}

/* ── Section label ── */

.section-label {
  font-family: var(--fd);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink-faint);
}

/* ── Previously approved banner ── */

.prev-approved-notice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--status-approved-bg);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--status-approved);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.prev-approved-notice svg { width: 13px; height: 13px; flex-shrink: 0; }
