/* App layout & components — Twiqor CRM v2 */

/* ============== LOGIN ============== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(249,115,22,0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(249,115,22,0.05), transparent 40%),
    var(--bg-0);
  padding: 20px;
}
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.login-card { width: 100%; max-width: 420px; }
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.logo-mark {
  width: 48px; height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}
.logo-mark.small { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.login-title { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-2); margin-bottom: 24px; font-size: 13px; }
.login-link { display: block; text-align: center; color: var(--text-2); font-size: 13px; margin-top: 12px; transition: color var(--transition); }
.login-link:hover { color: var(--accent); }
.login-footer { color: var(--text-3); font-size: 12px; }

/* ============== CARD ============== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { font-size: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-sub { color: var(--text-2); font-size: 13px; margin-bottom: 16px; }

/* ============== FORMS ============== */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; }
.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.35);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  font-size: 13px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-input);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn i { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-icon { padding: 8px; }

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

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-2);
}
.btn-ghost:not(:disabled):hover { background: var(--bg-2); color: var(--text-1); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:not(:disabled):hover { background: #dc2626; border-color: #dc2626; }

.btn-link {
  background: transparent;
  color: var(--accent);
  padding: 4px 8px;
  border-color: transparent;
}
.btn-link:hover { color: var(--accent-hover); }

/* ============== APP SHELL ============== */
body.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar view";
  min-height: 100vh;
  transition: grid-template-columns var(--transition);
}
body.app.sidebar-collapsed { grid-template-columns: 64px 1fr; }

.sidebar {
  grid-area: sidebar;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-1);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  min-height: 56px;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-2);
  border-radius: var(--radius-input);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-item i { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item:hover:not(.disabled) { background: var(--bg-2); color: var(--text-1); }
.sidebar-item.active { background: rgba(249,115,22,0.12); color: var(--accent); }
.sidebar-item.disabled { opacity: 0.4; cursor: not-allowed; }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-1);
  display: flex;
  justify-content: flex-end;
}

body.app.sidebar-collapsed .sidebar-title,
body.app.sidebar-collapsed .sidebar-item .label { display: none; }
body.app.sidebar-collapsed .sidebar-item { justify-content: center; }
body.app.sidebar-collapsed .sidebar-header { justify-content: center; padding: 16px 0; }

/* ============== TOPBAR ============== */
.topbar {
  grid-area: topbar;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.breadcrumb { color: var(--text-2); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.breadcrumb .crumb-current { color: var(--text-1); font-weight: 500; }
.breadcrumb i { width: 14px; height: 14px; color: var(--text-3); }

.topbar-user { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-input);
  color: var(--text-1);
  transition: background var(--transition);
}
.user-btn:hover { background: var(--bg-2); }
.user-btn i { width: 14px; height: 14px; color: var(--text-2); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  text-transform: uppercase;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  min-width: 200px;
  padding: 6px;
  z-index: 30;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-input);
  color: var(--text-1);
  width: 100%;
  text-align: left;
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
}
.dropdown-item i { width: 16px; height: 16px; color: var(--text-2); }
.dropdown-item:hover { background: var(--bg-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger i { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border-1); margin: 6px 0; }

/* ============== VIEW ============== */
.view {
  grid-area: view;
  padding: 24px;
  overflow-y: auto;
}
.view h1.page-title { font-size: 22px; margin-bottom: 4px; }
.view p.page-sub { color: var(--text-2); margin-bottom: 20px; font-size: 14px; }

/* ============== GRID / KPIs ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  padding: 20px;
}
.kpi-label { color: var(--text-2); font-size: 13px; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 600; margin-bottom: 10px; }
.kpi-badge {
  display: inline-block;
  background: var(--bg-2);
  color: var(--text-3);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-2);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text-2);
}
.badge.success { background: rgba(16,185,129,0.1); color: var(--success); border-color: rgba(16,185,129,0.35); }
.badge.warning { background: rgba(245,158,11,0.1); color: var(--warning); border-color: rgba(245,158,11,0.35); }
.badge.danger { background: rgba(239,68,68,0.1); color: var(--danger); border-color: rgba(239,68,68,0.35); }
.badge.accent { background: rgba(249,115,22,0.1); color: var(--accent); border-color: rgba(249,115,22,0.35); }

/* ============== TABS ============== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  color: var(--text-2);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text-1); }
.tab.tab-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============== TABLES ============== */
.table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.table {
  font-size: 13px;
}
.table thead th {
  background: var(--bg-2);
  color: var(--text-2);
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-1);
}
.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-1);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-2); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .row-actions .btn { padding: 4px 8px; font-size: 12px; }
.table .expanded-row td {
  background: var(--bg-0);
  padding: 0;
}
.table .expanded-content {
  padding: 14px;
  border-left: 3px solid var(--accent);
}
.table .expanded-content pre {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  padding: 12px;
  font-size: 12px;
  color: var(--text-1);
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}
.table .expanded-content .json-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 800px) {
  .table .expanded-content .json-grid { grid-template-columns: 1fr; }
}

/* ============== MODAL ============== */
.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 20px;
  animation: fade-in var(--transition);
}
.modal-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  animation: slide-up var(--transition);
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-1);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============== TOAST ============== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-input);
  color: var(--text-1);
  font-size: 13px;
  max-width: 380px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  animation: toast-in var(--transition);
}
.toast.toast-out { animation: toast-out var(--transition) forwards; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ============== APPLE-STYLE CHECKBOX ============== */
.apple-check {
  position: relative;
  display: inline-flex;
  width: 20px;
  height: 20px;
  cursor: pointer;
}
.apple-check input {
  opacity: 0;
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.apple-check .box {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.apple-check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.apple-check .box svg {
  width: 14px;
  height: 14px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition);
}
.apple-check input:checked + .box svg { opacity: 1; }
.apple-check input:disabled { cursor: not-allowed; }
.apple-check input:disabled + .box { opacity: 0.5; cursor: not-allowed; }

/* ============== MATRIX (roles / perms) ============== */
.matrix-wrap { overflow-x: auto; background: var(--bg-1); border: 1px solid var(--border-1); border-radius: var(--radius-card); }
.matrix {
  width: 100%;
  font-size: 13px;
  min-width: 720px;
}
.matrix thead th {
  position: sticky;
  top: 0;
  background: var(--bg-2);
  padding: 12px 14px;
  text-align: center;
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.matrix thead th.first-col { text-align: left; min-width: 280px; }
.matrix tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border-1); text-align: center; vertical-align: middle; }
.matrix tbody td.first-col { text-align: left; color: var(--text-1); }
.matrix tbody td.first-col .slug { color: var(--text-3); font-size: 11px; font-family: ui-monospace, monospace; }
.matrix tbody tr:hover { background: var(--bg-2); }
.matrix .cat-row td {
  background: var(--bg-0);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 10px 14px;
  text-align: left;
}
.matrix tfoot td { padding: 14px; background: var(--bg-2); border-top: 1px solid var(--border-1); }
.matrix .role-owner-col { color: var(--accent); }
.matrix .crit-badge {
  margin-left: 6px;
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 10px;
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.08);
  text-transform: uppercase;
}

/* ============== PAGINATION ============== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 4px;
  color: var(--text-2);
  font-size: 13px;
}
.pagination .pg-controls { display: flex; gap: 8px; align-items: center; }

/* ============== MISC ============== */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.mb-16 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-2); }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--text-2);
}
.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) auto;
  gap: 12px;
  margin-bottom: 16px;
  align-items: end;
}
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.qr-wrap img {
  width: 200px;
  height: 200px;
  background: #fff;
  padding: 10px;
  border-radius: var(--radius-input);
}
.secret-code {
  font-family: ui-monospace, monospace;
  background: var(--bg-2);
  padding: 8px 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-2);
  font-size: 13px;
  user-select: all;
}

/* ============== CRITICAL MODAL (doble confirmación) ============== */
.critical-modal-card {
  max-width: 480px;
}
.critical-modal-title {
  font-size: 16px;
  font-weight: 600;
}
.critical-modal-title.danger {
  color: var(--danger);
}
.critical-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.critical-modal-desc {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.critical-modal-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.4);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  font-size: 13px;
}
.critical-modal-counter {
  color: var(--text-3);
  font-size: 11px;
  margin-top: 4px;
  font-family: ui-monospace, monospace;
}
.critical-modal-counter.ok {
  color: var(--success);
}
.danger-button {
  background: var(--danger) !important;
  color: #fff !important;
  border-color: var(--danger) !important;
  font-weight: 600;
}
.danger-button:not(:disabled):hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}
.danger-button.is-loading {
  opacity: 0.85;
  cursor: progress;
}

/* ============== IMPERSONATION BANNER ============== */
.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #4a1a1a;
  border-bottom: 2px solid #ff4747;
  color: #ff9999;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  z-index: 1000;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.impersonation-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.impersonation-banner-label {
  background: #ff4747;
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}
.impersonation-banner-sep {
  color: #ff4747;
}
.impersonation-banner-who {
  color: #ffd5d5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.impersonation-banner-countdown {
  font-family: ui-monospace, monospace;
  color: #ffd5d5;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid rgba(255, 71, 71, 0.5);
  font-size: 13px;
  font-weight: 600;
}
.impersonation-banner-countdown.urgent {
  color: #fff;
  background: #ff4747;
  border-color: #ff4747;
  animation: banner-pulse 1s ease-in-out infinite;
}
@keyframes banner-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.impersonation-banner-actions {
  display: flex;
  gap: 8px;
}
.impersonation-banner-btn {
  background: transparent;
  color: #ff9999;
  border: 1px solid #ff4747;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  white-space: nowrap;
}
.impersonation-banner-btn:hover:not(:disabled) {
  background: rgba(255, 71, 71, 0.2);
  color: #fff;
}
.impersonation-banner-btn.danger {
  background: #ff4747;
  color: #fff;
  border-color: #ff4747;
}
.impersonation-banner-btn.danger:hover:not(:disabled) {
  background: #ff2020;
  border-color: #ff2020;
}
.impersonation-banner-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Desplazamiento del layout cuando el banner está activo */
body.impersonation-active {
  padding-top: 48px;
}
body.app.impersonation-active .sidebar {
  top: 48px;
  height: calc(100vh - 48px);
}
body.app.impersonation-active .topbar {
  top: 48px;
}

@media (max-width: 720px) {
  .impersonation-banner {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
  }
}

/* ============== PRODUCT ACTIONS TABS (ficha cliente 360) ============== */
.prod-actions-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 16px;
  overflow-x: auto;
  background: var(--bg-1);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  padding: 0 4px;
}
.prod-actions-tab {
  padding: 10px 14px;
  color: var(--text-2);
  font-size: 13px;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
  font-weight: 500;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.prod-actions-tab:hover {
  color: var(--text-1);
  background: var(--bg-2);
}
.prod-actions-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}
.prod-actions-tab i {
  width: 14px;
  height: 14px;
}
.prod-actions-section {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  margin-top: 16px;
  overflow: hidden;
}
.prod-actions-section-header {
  padding: 16px 20px 0 20px;
}
.prod-actions-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.prod-actions-section-sub {
  color: var(--text-2);
  font-size: 12px;
  margin-bottom: 4px;
}
.prod-actions-panel {
  padding: 16px 20px 20px 20px;
  min-height: 140px;
}

/* ============== METRIC CARDS ============== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.metric-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 150ms ease;
}
.metric-card:hover { border-color: var(--border-2); }
.metric-card-label {
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.metric-card-value {
  color: var(--text-1);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}
.metric-card-sub {
  color: var(--text-3);
  font-size: 11px;
}
.metric-warning-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warning);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ============== ACTIONS BUTTONS GRID ============== */
.actions-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-input);
  color: var(--text-1);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  font-size: 13px;
  font-weight: 500;
}
.action-btn:hover:not(:disabled) {
  background: var(--bg-1);
  border-color: var(--accent);
}
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.action-btn .action-btn-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.action-btn .action-btn-sub {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 400;
}
.action-btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
}
.action-btn.danger .action-btn-title {
  color: var(--danger);
}
.action-btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

/* ============== CREDITS TABLE ============== */
.credits-table {
  width: 100%;
  font-size: 13px;
}
.credits-table thead th {
  background: var(--bg-2);
  color: var(--text-2);
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-1);
}
.credits-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-1);
  vertical-align: middle;
}
.credits-table tbody tr:last-child td { border-bottom: none; }
.credits-table tbody tr:hover { background: var(--bg-2); }
.credits-summary {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.credits-summary .months-count {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

/* ============== MOLLIE CARDS ============== */
.mollie-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.mollie-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  padding: 14px 16px;
}
.mollie-card-title {
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 500;
}
.mollie-card-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border-1);
}
.mollie-card-row:last-child { border-bottom: none; }
.mollie-card-row .k { color: var(--text-2); }
.mollie-card-row .v {
  color: var(--text-1);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  text-align: right;
  word-break: break-all;
}

/* ============== AUDIT TIMELINE ============== */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-item {
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  background: var(--bg-2);
  overflow: hidden;
  transition: border-color 150ms ease;
}
.audit-item:hover { border-color: var(--border-2); }
.audit-item-head {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.audit-item-head i {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  transition: transform 150ms ease;
}
.audit-item.open .audit-item-head i {
  transform: rotate(90deg);
}
.audit-item-time {
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  font-family: ui-monospace, monospace;
}
.audit-item-user {
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.audit-item-action {
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.audit-item-summary {
  color: var(--text-1);
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-item-body {
  padding: 12px 14px;
  border-top: 1px solid var(--border-1);
  background: var(--bg-0);
  display: none;
}
.audit-item.open .audit-item-body { display: block; }
.audit-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 800px) {
  .audit-diff-grid { grid-template-columns: 1fr; }
}
.audit-diff-col .diff-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.audit-diff-col pre {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-input);
  padding: 10px;
  font-size: 11px;
  color: var(--text-1);
  overflow: auto;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
}
