/* =========================
   BUTTONS (GRADIENT SYSTEM)
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: var(--font-md);
    line-height: 1.2;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-button);
    box-sizing: border-box;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* =========================
   PRIMARY
========================= */

.btn-primary {
    background: var(--color-button-bg-primary);
    color: var(--color-white);
    border-color: transparent;
    box-shadow: var(--shadow-button-primary);
}

.btn-primary:hover {
    filter: brightness(1.03);
    box-shadow: var(--shadow-glow);
}

/* =========================
   SECONDARY
========================= */

.btn-secondary {
    background: var(--color-white);
    color: var(--color-button-secondary);
    border: 1px solid var(--color-border-secondary);
}

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

.btn-secondary:active {
    background: var(--color-button-bg-secondary-hover);
    border-color: var(--color-button-secondary);
    box-shadow: inset 0 2px 4px var(--color-shadow-dark), 0 1px 0 var(--color-shadow-light);
}

.btn-secondary:disabled,
.btn-secondary[disabled],
.btn-success:disabled,
.btn-success[disabled] {
    background: var(--color-bg);
    color: var(--color-button-secondary-disabled);
    border-color: var(--color-border);
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* =========================
   SUPPORT
========================= */

.btn-support {
    background: var(--color-white);
    color: var(--color-purple);
    border: 1px solid var(--color-border-support);
}

.btn-support:hover {
    background: var(--color-support-bg-hover);
    border-color: var(--color-support-hover);
}


/* =========================
   DANGER
========================= */

.btn-danger {
    background: var(--color-white);
    color: var(--color-error);
    border: 1px solid var(--color-border-danger);
}

.btn-danger:hover {
    background: var(--color-danger-bg-hover);
    border-color: var(--color-border-danger);
    color: var(--color-danger-hover);
}

.btn-danger:active {
    background: var(--color-danger-bg);
    border-color: var(--color-danger-hover);
    box-shadow: inset 0 2px 4px var(--color-shadow-dark), 0 1px 0 var(--color-shadow-light);
    transform: translateY(1px);
    color: var(--color-danger-active);
}

.btn-danger:disabled,
.btn-danger[disabled] {
    background: var(--color-white);
    color: var(--color-border-danger);
    border-color: var(--color-border);
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}


.btn-danger-text {
  background: transparent;
  color: var(--color-error);
}

.btn-sm,
.btn-small {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-sm);
    border-radius: var(--radius-sm);
}

.btn-large {
    padding: var(--space-lg) var(--space-3xl);
    font-size: var(--font-lg);
}

.btn-success {
    background: var(--color-white);
    color: var(--color-success-text);
    border: 1px solid var(--color-success);
}

.btn-success:hover {
    background: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.btn-success:active {
    background: var(--color-success-strong);
    border-color: var(--color-success-strong);
    color: var(--color-white);
}

/* =========================
   HELP TOOLTIP
========================= */

.checkbox-help-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.help-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.help-tooltip-trigger {
    width: 22px;
    height: 22px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-round);
    background: var(--color-white);
    color: var(--color-button-secondary);
    font-size: var(--font-xs);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    cursor: help;
}

.help-tooltip-trigger:hover,
.help-tooltip-trigger:focus-visible {
    border-color: var(--color-border-secondary);
    color: var(--color-button-secondary-hover);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.help-tooltip-content {
    position: absolute;
    left: 50%;
    bottom: calc(100% + var(--space-sm));
    z-index: 30;
    width: min(320px, 80vw);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: var(--color-text-inverse);
    font-size: var(--font-sm);
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.help-tooltip:hover .help-tooltip-content,
.help-tooltip:focus-within .help-tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* =========================
   CARDS
========================= */

.card {
    background: var(--color-bg-main);
    padding: var(--space-2xl);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);

    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.card h2 {
    margin-bottom: var(--space-lg);
}

.card h3 {
    margin: 0 0 var(--space-md) 0;
}
/*
.card p {
    font-size: var(--font-2xl);
    margin: 0;
}
*/
/* =========================
   TABLE
========================= */

.table {
    width: 100%;
    background: var(--color-bg-main);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table thead {
    background-color: var(--color-bg-subtle);
    color: var(--color-text-strong);
}

.table th {
    text-align: left;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-md);
    color: var(--color-text-secondary);
}

.table a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    width: 100%;
}

.table th a:hover {
    text-decoration: underline;
}

.table td {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-border-table);
    color: var(--color-text);
    transition: background-color var(--transition-fast);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background-color: var(--color-bg-hover);
}

.table-empty {
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.clickable-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.clickable-row:hover {
    background-color: var(--color-bg-hover);
}

.table-sm th,
.table-sm td {
    padding: var(--space-2);
}

/* =========================
   BADGES
========================= */

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    gap: var(--space-xs);
    padding: var(--space-2xs) var(--space-md);
    border-radius: var(--radius-round);
    font-size: var(--font-xs);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
    background-color: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}

.badge-success::before,
.badge-progress::before,
.badge-info::before,
.badge-warning::before,
.badge-danger::before,
.badge-error::before,
.badge-neutral::before,
.badge-paid::before,
.badge-planned::before,
.badge-overdue::before,
.badge-missed::before,
.badge[class*="status-"]::before {
    content: "";
    flex: 0 0 auto;
    width: 0.65em;
    height: 0.65em;
    border-radius: var(--radius-round);
    background: currentColor;
}

.badge.status-active,
.badge.status-achieved,
.badge.status-paid,
.badge.status-completed,
.badge.status-sent,
.badge.status-synced,
.badge.status-connected,
.badge.status-verified,
.badge.status-closed,
.badge-success,
.badge-paid {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
}

.badge.status-open,
.badge.status-in_progress,
.badge.status-in-progress,
.badge.status-ready,
.badge.status-processing,
.badge-progress,
.badge-info {
    background-color: var(--color-info-bg);
    color: var(--color-button-secondary-hover);
}

.badge.status-planned,
.badge.status-pending,
.badge.status-upcoming,
.badge.status-expiring,
.badge.status-needs_reauth,
.badge.status-needs-reauth,
.badge-warning,
.badge-planned {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.badge.status-expired,
.badge.status-overdue,
.badge.status-missed,
.badge.status-cancelled,
.badge.status-terminated,
.badge.status-failed,
.badge.status-error,
.badge-error,
.badge-danger,
.badge-overdue,
.badge-missed {
    background-color: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.badge.status-draft,
.badge.status-inactive,
.badge.status-skipped,
.badge.status-archived,
.badge.status-disabled,
.badge.status-unknown,
.badge-neutral {
    background-color: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}

/* =========================
   STATUS (DOT STYLE)
========================= */

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: var(--font-weight-medium);
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-round);
    display: inline-block;
    box-shadow: var(--shadow-dot);
}

.status-dot.status-planned {
    background-color: var(--color-info);
}

.status-dot.status-paid {
    background-color: var(--color-success);
}

.status-dot.status-active {
    background-color: var(--color-success);
}

.status-dot.status-overdue {
    background-color: var(--color-danger);
}

.status-dot.status-missed {
    background-color: var(--color-danger);
}

.status-dot.status-draft,
.status-dot.status-archived,
.status-dot.status-skipped {
    background-color: var(--color-neutral-mid);
}

.status-dot.status-ready,
.status-dot.status-pending {
    background-color: var(--color-info);
}

.status-dot.status-sent {
    background-color: var(--color-success);
}

.status-dot.status-failed {
    background-color: var(--color-danger);
}

.newsletter-campaign-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
}

.newsletter-campaign-actions form {
    margin: 0;
}

/* =========================
   FORMS
========================= */

.form-container {
    background: var(--color-bg-main);
    padding: var(--space-4xl);
    border-radius: var(--radius-xl);
    max-width: var(--content-max-form);
    box-shadow: var(--shadow-sm);
}

.input {
    width: 100%;
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius-lg);
    background: var(--color-bg-main);
    color: var(--color-text);
    font-size: var(--font-md);
    box-sizing: border-box;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

.input::placeholder {
    color: var(--color-text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.select {
    min-height: 40px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    background: var(--color-bg-main);
    color: var(--color-text);
    font-size: var(--font-md);
    box-sizing: border-box;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

.select:focus {
    outline: none;
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.crm-form p {
    margin-bottom: var(--space-xl);
}

.crm-form label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

.crm-form input,
.crm-form textarea,
.crm-form select {
    width: 100%;
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius-lg);
    font-size: var(--font-md);
    box-sizing: border-box;
    background: var(--color-bg-main);
}

.crm-form input::placeholder,
.crm-form textarea::placeholder {
    color: var(--color-text-muted);
}

.crm-form textarea {
    min-height: 120px;
    resize: vertical;
}

.crm-form input:focus,
.crm-form textarea:focus,
.crm-form select:focus {
    outline: none;
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.progress {
    width: 100%;
    height: var(--space-sm);
    border-radius: var(--radius-round);
    background: var(--color-neutral-bg);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--gradient-progress);
    transition: width var(--transition-fast);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input,
.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    width: 100%;
    padding-right: 48px;
    box-sizing: border-box;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-md);
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: var(--color-sidebar-hover);
    color: var(--color-button-secondary-hover);
    outline: none;
}

.password-toggle-icon,
.password-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

.password-toggle svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle-slash {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.password-toggle.is-visible .password-toggle-slash {
    opacity: 1;
}

/* =========================
   TOAST
========================= */

.toast {
    position: fixed;
    bottom: var(--space-2xl);
    right: var(--space-2xl);
    background: var(--color-secondary);
    color: var(--color-text-inverse);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-fast);
    font-size: var(--font-md);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   PAGINATION
========================= */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-2xl);
}

.pagination .btn {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-xs);
    text-decoration: none;
    color: inherit;
}

.pagination .current {
    padding: var(--space-xs) var(--space-md);
    font-weight: var(--font-weight-bold);
    background: var(--color-secondary);
    color: var(--color-text-inverse);
    border-radius: var(--radius-xs);
}

.page-info {
    margin: 0 var(--space-md);
}

/* =========================
   MODAL POPUPS
========================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--color-overlay);
}

.modal-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    position: relative;
    width: 400px;
    max-width: 400px;
    margin: 15vh auto;
    background: var(--color-bg-main);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.modal-list {
    margin-top: var(--space-md);
    padding-left: 16px;
    color: var(--color-text-muted);
    font-size: var(--font-sm);
}

/* =========================
   CHECKLIST MODAL POPUPS
========================= */

#checklist-modal input {
    width: 100%;
    margin-bottom: var(--space-md);
}

.popover {
    position: absolute;
    z-index: 1000;
}

.popover.hidden {
    display: none;
}

.popover-content {
    width: 100%;
    max-width: 520px; /* 👈 adjust if needed */
    background: var(--color-bg-main);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl);
}

.popover-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* =========================
   CHECKLIST MODAL POPUPS
========================= */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.invite-form-actions.hidden,
.invite-form-actions[hidden] {
  display: none !important;
}

.invite-result {
  margin-top: var(--space-md);
  font-size: 14px;
}
/* =========================
   IMPORT INTERFACE
========================= */
.error-list {
    color: var(--color-danger);
    padding-left: 16px;
}

.status-dot.status-warning {
    background: var(--color-warning);
}

.status-dot.status-success {
    background: var(--color-success);
}
