.ci-portal {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
}

.ci-portal h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.ci-portal h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.ci-portal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ci-portal-header h2 {
    margin-bottom: 0;
    flex: 1;
}

.ci-welcome {
    color: #666;
    font-size: 0.9rem;
}

.ci-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    background: #fff;
    color: #333;
    transition: background 0.15s;
}

.ci-btn:hover {
    background: #f5f5f5;
}

.ci-btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.ci-btn-primary:hover {
    background: #1d4ed8;
}

.ci-btn-secondary {
    background: #f9fafb;
    color: #374151;
}

.ci-btn-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
}

.ci-field {
    margin-bottom: 16px;
}

.ci-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.ci-field input,
.ci-field select,
.ci-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    box-sizing: border-box;
}

.ci-field input:focus,
.ci-field select:focus,
.ci-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ci-field-row {
    display: flex;
    gap: 16px;
}

.ci-field-row .ci-field {
    flex: 1;
}

.ci-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.ci-table th {
    background: #f9fafb;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    border-bottom: 2px solid #e5e7eb;
}

.ci-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.ci-table tr:hover {
    background: #f9fafb;
}

.ci-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.ci-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ci-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.ci-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #2563eb;
}

.ci-stat-label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
}

.ci-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.ci-badge-active { background: #d1fae5; color: #065f46; }
.ci-badge-suspended { background: #fef3c7; color: #92400e; }
.ci-badge-cancelled { background: #fee2e2; color: #991b1b; }
.ci-badge-pending { background: #dbeafe; color: #1e40af; }
.ci-badge-unpaid { background: #fef3c7; color: #92400e; }
.ci-badge-paid { background: #d1fae5; color: #065f46; }
.ci-badge-overdue { background: #fee2e2; color: #991b1b; }
.ci-badge-open { background: #dbeafe; color: #1e40af; }
.ci-badge-in_progress { background: #fef3c7; color: #92400e; }
.ci-badge-closed { background: #f3f4f6; color: #6b7280; }
.ci-badge-investigating { background: #fef3c7; color: #92400e; }
.ci-badge-resolved { background: #d1fae5; color: #065f46; }

.ci-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.ci-alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.ci-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.ci-alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.ci-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ci-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.ci-portal-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.ci-nav-link {
    padding: 10px 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.ci-nav-link:hover {
    background: #e5e7eb;
}

.ci-login {
    max-width: 400px;
}

.ci-login form {
    margin-top: 16px;
}

.ci-language-toggle {
    margin-top: 16px;
    text-align: center;
    font-size: 0.85rem;
}

.ci-language-toggle a {
    color: #2563eb;
    text-decoration: none;
}

.ci-ticket-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.ci-ticket-body {
    background: #f9fafb;
}

.ci-ticket-reply {
    background: #fff;
    margin-left: 24px;
}

.ci-reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #6b7280;
}

.ci-filters {
    margin-bottom: 16px;
}

.ci-filters select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.ci-outage {
    border-left: 4px solid #f59e0b;
}

.ci-outage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

@media (max-width: 640px) {
    .ci-portal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ci-stats {
        grid-template-columns: 1fr;
    }

    .ci-field-row {
        flex-direction: column;
    }

    .ci-table {
        font-size: 0.8rem;
    }

    .ci-table th, .ci-table td {
        padding: 6px 8px;
    }
}

/* --- Catalog --------------------------------------------------------- */
.ci-catalog { max-width: 1100px; margin: 0 auto; }
.ci-catalog-group { margin-bottom: 32px; }
.ci-catalog-group-title { font-size: 18px; font-weight: 600; margin: 0 0 16px; color: #333; }
.ci-catalog-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.ci-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.ci-card:hover { border-color: #2563eb; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ci-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ci-card-title { margin: 0; font-size: 17px; font-weight: 600; color: #111827; }
.ci-card-code { font-size: 11px; color: #6b7280; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.ci-card-description { font-size: 13px; color: #4b5563; margin: 0; flex: 1; }
.ci-card-price { margin-top: 8px; }
.ci-card-price-amount { font-size: 28px; font-weight: 700; color: #111827; }
.ci-card-price-period { font-size: 13px; color: #6b7280; margin-left: 4px; }
.ci-card-setup { font-size: 12px; color: #6b7280; }
.ci-card .ci-btn { margin-top: auto; }


/* Generic buttons */
.ci-btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color .15s ease;
}
.ci-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ci-btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.ci-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.ci-btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.ci-btn-secondary:hover:not(:disabled) { background: #f9fafb; }

/* Signup panel */
.ci-catalog-signup-panel {
    margin-top: 32px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.ci-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.ci-panel-title { margin: 0; font-size: 18px; font-weight: 600; }
.ci-panel-product-name { color: #2563eb; }
.ci-panel-close {
    background: transparent;
    border: 0;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}
.ci-panel-close:hover { color: #374151; }
.ci-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 20px;
}
.ci-fieldset legend {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    margin-bottom: 10px;
    padding: 0;
}
.ci-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.ci-row:has(.ci-field-narrow) {
    grid-template-columns: 2fr 1fr 1fr;
}
.ci-field { display: flex; flex-direction: column; gap: 4px; }
.ci-field-wide { grid-column: 1 / -1; }
.ci-field span { font-size: 12px; font-weight: 500; color: #374151; }
.ci-field input, .ci-field select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.ci-field input:focus, .ci-field select:focus {
    outline: 0;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.ci-hint { font-size: 12px; color: #6b7280; margin: 8px 0 16px; }
.ci-payment-fieldset .ci-moneris-frame-wrap {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.ci-payment-fieldset .ci-moneris-frame { display: block; width: 100%; min-height: 240px; }
.ci-payment-status {
    margin: 10px 0 0;
    padding: 8px 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    border-radius: 4px;
    font-size: 13px;
}
.ci-payment-status-pan { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Signup panel: two-column layout (form left, summary right on desktop). */
.ci-signup-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}
.ci-signup-layout .ci-signup-form { min-width: 0; }
@media (max-width: 800px) {
    .ci-signup-layout { grid-template-columns: 1fr; }
}

/* Billing cycle radio rows */
.ci-cycle-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ci-cycle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.ci-cycle-row:hover { border-color: #93c5fd; }
.ci-cycle-row input[type="radio"] { margin: 0; flex-shrink: 0; }
.ci-cycle-row:has(input[type="radio"]:checked) {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.ci-cycle-label { display: flex; flex-direction: column; gap: 2px; }
.ci-cycle-price { font-weight: 600; font-size: 14px; color: #111827; }
.ci-cycle-meta  { font-size: 12px; color: #059669; }
.ci-cycle-meta:empty { display: none; }

/* Available add-ons (signup form) */
.ci-addons-fieldset .ci-addons-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.ci-addons-fieldset .ci-addon-row + .ci-addon-row { border-top: 1px solid #f3f4f6; }
.ci-addons-fieldset .ci-addon-row:nth-child(even) { background: #fafafa; }
.ci-addon-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
}
.ci-addon-label input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.ci-addon-text  { font-size: 13px; color: #111827; }
.ci-addon-name  { font-weight: 500; }
.ci-addon-price { color: #6b7280; margin-left: 4px; }
.ci-addon-row:has(input[type="checkbox"]:checked) { background: #eff6ff; }

/* Order summary sidebar */
.ci-order-summary {
    position: sticky;
    top: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}
.ci-summary-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    margin: 0 0 10px;
}
.ci-summary-product {
    font-weight: 600;
    font-size: 15px;
    color: #111827;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}
.ci-summary-product:empty { display: none; }
.ci-summary-lines {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 6px;
    column-gap: 12px;
    font-size: 13px;
    color: #374151;
    margin: 0 0 12px;
}
.ci-summary-lines dt { margin: 0; }
.ci-summary-lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ci-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    font-weight: 600;
    color: #111827;
}
.ci-summary-total-label { font-size: 13px; }
.ci-summary-total-value { font-size: 16px; font-variant-numeric: tabular-nums; }
.ci-summary-disclaimer {
    font-size: 11px;
    color: #6b7280;
    margin: 10px 0 0;
    line-height: 1.45;
}

.ci-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}
.ci-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f3f4f6;
    padding-top: 16px;
}

/* Success */
.ci-catalog-success {
    margin-top: 32px;
    background: #fff;
    border: 1px solid #d1fae5;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
}
.ci-success-icon {
    width: 56px; height: 56px;
    background: #10b981;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 12px;
}
.ci-catalog-success h3 { margin: 0 0 12px; font-size: 22px; }
.ci-success-message { color: #4b5563; margin: 0 auto 20px; max-width: 480px; }
.ci-success-details {
    display: grid;
    grid-template-columns: auto auto;
    gap: 6px 16px;
    justify-content: center;
    margin: 0 auto 20px;
    text-align: left;
}
.ci-success-details dt { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; align-self: center; }
.ci-success-details dd { margin: 0; font-family: monospace; font-weight: 600; color: #111827; }

/* Alerts */
.ci-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.ci-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.ci-empty { padding: 32px; text-align: center; color: #6b7280; }

@media (max-width: 640px) {
    .ci-row { grid-template-columns: 1fr; }
    .ci-row:has(.ci-field-narrow) { grid-template-columns: 1fr; }
}
