/* ========================================
   Registration Page Styles
   ======================================== */

.register-page {
    background: var(--gray-50);
    min-height: 100vh;
}

.register-page .navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}

.register-section {
    padding: 3rem 0 4rem;
}

.register-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: start;
}

.register-benefits {
    display: none;
}

/* Benefits Side */
.register-benefits {
    padding-top: 2rem;
}

.register-benefits h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.register-benefits > p {
    color: var(--gray-500);
    font-size: 1.125rem;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.benefit-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.benefit-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.benefit-icon {
    color: var(--success);
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.benefit-item strong {
    display: block;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.benefit-item p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
}

.selected-plan-box {
    margin-top: 2rem;
    padding: 20px;
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius);
}

.selected-plan-box h4 {
    color: var(--primary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Form Side */
.register-form-wrap {
    position: relative;
}

.register-form {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.register-form h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* Step Indicators */
.form-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.form-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    transition: var(--transition);
}

.form-step-indicator.active .step-dot,
.form-step-indicator.completed .step-dot {
    background: var(--primary);
    color: var(--white);
}

.form-step-indicator.completed .step-dot {
    background: var(--success);
}

.form-step-indicator.completed {
    cursor: pointer;
}
.form-step-indicator.completed:hover .step-dot {
    filter: brightness(1.15);
    transform: scale(1.1);
}
.form-step-indicator.completed:hover .step-text {
    color: var(--success);
}

.step-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-step-indicator.active .step-text {
    color: var(--primary);
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--gray-200);
    margin: 0 12px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.step-line.completed {
    background: var(--success);
}

/* Form Steps Content */
.form-step-content {
    display: none;
}

.form-step-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.form-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
}

.toggle-password:hover {
    color: var(--gray-600);
}

.password-strength {
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--gray-200);
    overflow: hidden;
}

.password-strength .strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.domain-check {
    margin-top: 6px;
    font-size: 0.8125rem;
}

.domain-check.available {
    color: var(--success);
}

.domain-check.taken {
    color: var(--danger);
}

.domain-check.checking {
    color: var(--gray-400);
}

/* Form Buttons */
.form-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 1rem;
}

/* Plan Selection Cards */
.plan-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.plan-option {
    cursor: pointer;
}

.plan-option input[type="radio"] {
    display: none;
}

.plan-option-content {
    position: relative;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: var(--transition);
}

.plan-option input:checked + .plan-option-content {
    border-color: var(--primary);
    background: var(--primary-50);
}

.plan-option-content.popular {
    border-color: var(--primary-light);
}

.mini-badge {
    position: absolute;
    top: -10px;
    right: 12px;
    padding: 2px 10px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50px;
    font-size: 0.6875rem;
    font-weight: 700;
}

.plan-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.plan-option-header h4 {
    font-size: 1rem;
}

.plan-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.plan-price small {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--gray-500);
}

.plan-option-content ul {
    list-style: none;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.plan-option-content li {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* Checkbox */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    color: var(--gray-600) !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin-top: 3px;
    flex-shrink: 0;
}

/* Device Types Options */
.device-types-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.device-option {
    cursor: pointer;
    display: block;
}

.device-option input[type="checkbox"] {
    display: none;
}

.device-option-content {
    position: relative;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.device-option input:checked + .device-option-content {
    border-color: var(--primary);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.device-option-content i {
    font-size: 2rem;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

.device-option-content h4 {
    margin: 8px 0 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.device-option-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
}

/* Gateway Types Options */
.gateway-types-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.gateway-option {
    cursor: pointer;
    display: block;
}

.gateway-option input[type="radio"] {
    display: none;
}

.gateway-option-content {
    position: relative;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.gateway-option input:checked + .gateway-option-content {
    border-color: var(--primary);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.gateway-option-content i {
    font-size: 2rem;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

.gateway-option-content h4 {
    margin: 8px 0 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.gateway-option-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
}

.checkbox-label a {
    color: var(--primary);
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Processing State */
.processing-state {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-state h3 {
    margin-bottom: 1.5rem;
}

.progress-log {
    text-align: left;
    background: var(--gray-900);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.progress-log .log-entry {
    color: var(--gray-400);
}

.progress-log .log-entry.success {
    color: #10B981;
}

.progress-log .log-entry.error {
    color: #EF4444;
}

.progress-log .log-entry.info {
    color: #06B6D4;
}

/* Success State */
.success-state {
    text-align: center;
    padding: 1rem 0;
}

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.success-state h3 {
    margin-bottom: 0.5rem;
}

.success-state > p {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.credentials-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 2rem;
    text-align: left;
}

.credentials-box h4 {
    margin-bottom: 12px;
    font-size: 0.9375rem;
}

.credential-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-200);
}

.credential-row:last-child {
    border-bottom: none;
}

.credential-label {
    font-weight: 600;
    color: var(--gray-600);
    width: 100px;
    font-size: 0.875rem;
}

.credential-value {
    color: var(--gray-800);
    font-size: 0.875rem;
    word-break: break-all;
}

.next-steps {
    text-align: left;
    margin-bottom: 2rem;
}

.next-steps h4 {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.next-steps ol {
    padding-left: 20px;
}

.next-steps li {
    margin-bottom: 12px;
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.next-steps code {
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8125rem;
}

.next-steps a {
    color: var(--primary);
    font-size: 0.8125rem;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 1rem;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

.error-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Step Title */
.step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    margin-bottom: 4px;
    color: var(--gray-800);
}

.step-title i {
    color: var(--primary);
}

.step-desc {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Range slider */
.range-field {
    display: flex;
    align-items: center;
    gap: 16px;
}

.range-field input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
}

.range-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid var(--white);
    box-shadow: 0 2px 6px rgba(108,43,217,0.3);
}

.range-value {
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 700;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
}

/* IVR Config Cards */
.ivr-config-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--gray-50);
}

.ivr-config-card .ivr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.ivr-config-card .ivr-header h4 {
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.ivr-config-card .ivr-header h4 i {
    font-size: 0.8125rem;
}

.ivr-recording-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 12px;
    position: relative;
}

.ivr-recording-upload:hover {
    border-color: var(--primary);
    background: var(--primary-50);
}

.ivr-recording-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.ivr-recording-upload i {
    font-size: 1.5rem;
    color: var(--gray-400);
    margin-bottom: 4px;
}

.ivr-recording-upload p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin: 0;
}

.ivr-recording-upload .file-name {
    color: var(--success);
    font-weight: 600;
    font-size: 0.875rem;
}

.ivr-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ivr-option-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}

.ivr-option-row input,
.ivr-option-row select {
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
}

.ivr-option-row .digit-label {
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-50);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.875rem;
}

.add-ivr-option {
    background: none;
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    padding: 8px;
    color: var(--gray-500);
    font-size: 0.8125rem;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    transition: var(--transition);
}

.add-ivr-option:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.875rem;
    border-radius: 4px;
}

.remove-btn:hover {
    color: var(--danger);
    background: #FEE2E2;
}

/* Review Table */
.review-table {
    margin-bottom: 1.5rem;
}

.review-section {
    margin-bottom: 16px;
}

.review-section h4 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-200);
}

.review-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
}

.review-row:last-child {
    border-bottom: none;
}

.review-label {
    color: var(--gray-500);
}

.review-value {
    font-weight: 600;
    color: var(--gray-800);
    text-align: right;
}

/* Call routes chart preview in review */
.review-section-chart { border-top: 2px solid var(--primary); padding-top: 10px; }
.review-chart-wrap { margin-top: 8px; border-radius: 8px; overflow: hidden; background: #0d1117; }
.review-chart-wrap svg { display: block; }

/* Config Summary sidebar */
.config-summary {
    margin-top: 1.5rem;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.config-summary h4 {
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.config-summary-item strong {
    color: var(--gray-800);
}

/* ========================================
   Installation Type Selection
   ======================================== */

.installation-types-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.installation-option {
    cursor: pointer;
}

.installation-option input[type="radio"] {
    display: none;
}

.installation-option-content {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.installation-option input:checked + .installation-option-content {
    border-color: var(--primary);
    background: var(--primary-50);
}

.installation-option h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--gray-800);
    font-size: 1rem;
}

.installation-option h4 i {
    color: var(--primary);
}

.installation-option-content p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin: 4px 0;
}

.installation-option-content small {
    color: var(--gray-500);
    font-size: 0.8125rem;
    display: block;
    margin-top: 8px;
}

/* ========================================
   Device & Trunk Selection
   ======================================== */

.device-types-container,
.trunk-services-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1rem;
}

.device-option,
.trunk-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.device-option:hover,
.trunk-option:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.device-option input[type="checkbox"],
.trunk-option input[type="radio"] {
    margin-right: 12px;
}

.device-option input[type="checkbox"]:checked + span,
.trunk-option input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.device-option span,
.trunk-option span {
    color: var(--gray-800);
    font-size: 0.9375rem;
    flex: 1;
}

.device-option small,
.trunk-option small {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-left: auto;
}

/* Field Hints */
.field-hint {
    display: block;
    margin-top: 4px;
    color: var(--gray-500);
    font-style: italic;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
    .register-layout {
        gap: 0;
    }
}

@media (max-width: 768px) {
    .register-form {
        padding: 24px;
    }

    .plan-option-content ul {
        flex-direction: column;
        gap: 4px;
    }
}

/* ============================================================
   FLOW DESIGNER - Drag & Drop Call Route Builder  v2
   ============================================================ */

.port-demo {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; background: #6C2BD9;
    border: 2px solid #fff; box-shadow: 0 0 0 2px #6C2BD9;
    vertical-align: middle; margin: 0 2px;
}

/* ---- Designer container ---- */
.flow-designer {
    display: flex;
    flex-direction: column;
    height: 460px;
    border: 1.5px solid rgba(108,43,217,0.25);
    border-radius: 14px;
    overflow: hidden;
    margin: 12px 0 16px;
    background: #0f0f18;
    transition: all 0.25s ease;
}

/* Window title bar — hidden normally, shown when maximized */
/* Always-visible title bar */
.flow-designer-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 40px;
    min-height: 40px;
    background: #110f20;
    border-bottom: 1px solid rgba(108,43,217,0.35);
    flex-shrink: 0;
}

.flow-designer-window-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.04em;
}
.flow-designer-window-title i { color: #6C2BD9; font-size: 0.88rem; }

.flow-designer-titlebar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Title-bar buttons */
.fd-tb-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 6px;
    font-size: 0.72rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all 0.15s; white-space: nowrap;
}
.fd-tb-btn-primary {
    background: rgba(108,43,217,0.18);
    border-color: rgba(108,43,217,0.4);
    color: #a78bfa;
}
.fd-tb-btn-primary:hover { background: rgba(108,43,217,0.35); color: #fff; }
.fd-tb-btn-danger {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.25);
    color: #f87171;
}
.fd-tb-btn-danger:hover { background: rgba(239,68,68,0.25); color: #fff; }

/* Maximized: thicker separator on title bar */
.flow-designer-maximized .flow-designer-titlebar {
    border-bottom-color: rgba(108,43,217,0.55);
    background: #0d0b1a;
}

/* Row body: toolbox | canvas | properties */
.flow-designer-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.flow-designer-maximized {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    margin: 0 !important;
}

/* ---- Toolbox ---- */
.flow-toolbox {
    width: 158px; min-width: 158px;
    background: #13121f;
    border-right: 1px solid rgba(255,255,255,0.07);
    padding: 12px 8px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}

.toolbox-title {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    padding: 0 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 4px;
}

.toolbox-section-label {
    font-size: 0.63rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.25); padding: 8px 4px 3px;
}

.toolbox-node {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 9px; border-radius: 8px; cursor: grab;
    font-size: 0.77rem; font-weight: 500;
    color: rgba(255,255,255,0.7);
    border: 1.5px solid rgba(255,255,255,0.06);
    transition: all 0.15s; user-select: none;
    background: rgba(255,255,255,0.03);
}
.toolbox-node:hover { background: rgba(108,43,217,0.25); border-color: rgba(108,43,217,0.6); color: #fff; transform: translateX(2px); }
.toolbox-node:active { cursor: grabbing; opacity: 0.7; }
.toolbox-node[data-node-type="inbound"]       { --nc: #22c55e; }
.toolbox-node[data-node-type="outbound"]      { --nc: #a855f7; }
.toolbox-node[data-node-type="gateway"]       { --nc: #94a3b8; }
.toolbox-node[data-node-type="timecondition"] { --nc: #f59e0b; }
.toolbox-node[data-node-type="ivr"]           { --nc: #3b82f6; }
.toolbox-node[data-node-type="ringgroup"]     { --nc: #8b5cf6; }
.toolbox-node[data-node-type="extension"]     { --nc: #06b6d4; }
.toolbox-node[data-node-type="queue"]         { --nc: #f97316; }
.toolbox-node[data-node-type="voicemail"]     { --nc: #ec4899; }
.toolbox-node[data-node-type="hangup"]        { --nc: #ef4444; }
.toolbox-node i { color: var(--nc, #6C2BD9); width: 14px; text-align: center; }

.toolbox-actions {
    margin-top: auto; padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex; flex-direction: column; gap: 5px;
}
.toolbox-btn {
    width: 100%; padding: 6px;
    background: rgba(108,43,217,0.12);
    border: 1px solid rgba(108,43,217,0.25);
    border-radius: 7px; color: #a78bfa;
    font-size: 0.72rem; cursor: pointer; transition: all 0.15s;
}
.toolbox-btn:hover { background: rgba(108,43,217,0.25); }
.toolbox-btn.toolbox-btn-danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); color: #ef4444; }
.toolbox-btn.toolbox-btn-danger:hover { background: rgba(239,68,68,0.22); }

/* ---- Canvas ---- */
.flow-canvas {
    flex: 1; position: relative; overflow: hidden;
    background-image: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 22px 22px; background-color: #0f0f18;
}
.flow-canvas.drag-over { background-color: #12102a; outline: 2px dashed rgba(108,43,217,0.4); outline-offset: -8px; }

.flow-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }

.flow-svg path.flow-connection {
    pointer-events: stroke; cursor: pointer;
    stroke: #94a3b8; stroke-width: 2; fill: none;
    marker-end: url(#arrowhead); transition: stroke 0.15s;
}
.flow-svg path.flow-connection:hover      { stroke: #6C2BD9; stroke-width: 2.5; marker-end: url(#arrowhead-hover); }
.flow-svg path.flow-connection.conn-yes   { stroke: #22c55e; marker-end: url(#arrowhead); }
.flow-svg path.flow-connection.conn-no    { stroke: #ef4444; marker-end: url(#arrowhead); }
.flow-svg path.flow-connection.conn-gateway { stroke: #a78bfa; stroke-dasharray: 6 3; marker-end: url(#arrowhead); }
.flow-svg text.conn-label { fill: rgba(255,255,255,0.4); font-size: 10px; pointer-events: none; }

.flow-temp-line { stroke: #6C2BD9; stroke-width: 2; stroke-dasharray: 6 4; fill: none; pointer-events: none; }

.flow-canvas-hint {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center; color: rgba(255,255,255,0.15);
    pointer-events: none;
}
.flow-canvas-hint i { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.flow-canvas-hint p { font-size: 0.82rem; margin: 0; }

/* ---- Toast ---- */
.flow-toast {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    padding: 7px 16px; border-radius: 8px; font-size: 0.8rem;
    z-index: 100; pointer-events: none; white-space: nowrap;
    animation: toastIn 0.2s ease;
}
.flow-toast-error { background: #7f1d1d; color: #fca5a5; border: 1px solid #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---- Nodes on canvas ---- */
.flow-node {
    position: absolute; min-width: 148px;
    background: #1a1a2e; border: 2px solid rgba(255,255,255,0.1);
    border-radius: 10px; cursor: move; user-select: none;
    z-index: 10; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.flow-node:hover    { box-shadow: 0 6px 28px rgba(0,0,0,0.6); z-index: 15; }
.flow-node.selected { border-color: #6C2BD9; box-shadow: 0 0 0 3px rgba(108,43,217,0.35), 0 6px 28px rgba(0,0,0,0.5); z-index: 20; }

.flow-node-header {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border-radius: 8px 8px 0 0;
    font-size: 0.74rem; font-weight: 700; color: #fff; letter-spacing: 0.04em;
}

/* Port legend bar */
.flow-node-portbar {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 3px 8px; border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 18px;
}
.portbar-in, .portbar-out { display: flex; flex-direction: column; gap: 2px; }
.portbar-out { align-items: flex-end; }
.portbar-label {
    font-size: 0.58rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; padding: 1px 4px; border-radius: 3px;
    opacity: 0.75;
}
/* Input port label: square badge, blue tones */
.portbar-in-lbl.type-call    { background: rgba(99,179,237,0.15); color: #60a5fa; }
.portbar-in-lbl.type-gateway { background: rgba(148,163,184,0.15); color: #94a3b8; }
/* Output port label: pill badge, green/purple tones */
.portbar-out-lbl.type-call    { background: rgba(74,222,128,0.12); color: #4ade80; }
.portbar-out-lbl.type-gateway { background: rgba(167,139,250,0.12); color: #a78bfa; }

.flow-node-label {
    padding: 5px 10px 7px; font-size: 0.78rem;
    color: rgba(255,255,255,0.75); font-weight: 500;
    text-align: center; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

/* Node delete button */
.flow-node-delete {
    position: absolute; top: -9px; right: -9px;
    width: 20px; height: 20px; background: #ef4444; color: #fff;
    border-radius: 50%; font-size: 10px; display: none;
    align-items: center; justify-content: center;
    cursor: pointer; z-index: 30; border: none; line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.flow-node:hover .flow-node-delete { display: flex; }
.flow-node-delete:hover { background: #b91c1c; transform: scale(1.15); }

/* ---- Ports ---- */
.flow-port {
    position: absolute;
    width: 14px; height: 14px;
    cursor: crosshair; z-index: 25; transition: all 0.12s;
    transform: translateY(-50%);
}

/* Shape by TYPE — matching shapes = compatible, so you can see they pair up */
.flow-port.port-type-call    { border-radius: 50%;  border: 2px solid #60a5fa; }  /* circle */
.flow-port.port-type-gateway { border-radius: 3px;  border: 2px solid #94a3b8; }  /* square */

/* Fill by DIRECTION — hollow = input (receiving), filled = output (sending) */
.flow-port.port-dir-in  { background: #0c1526; }           /* hollow dark */
.flow-port.port-dir-out.port-type-call    { background: #60a5fa; }
.flow-port.port-dir-out.port-type-gateway { background: #94a3b8; }

/* Output overrides for yes/no keys */
.flow-port.port-dir-out.port-key-out_yes { background: #22c55e; border-color: #22c55e; }
.flow-port.port-dir-out.port-key-out_no  { background: #ef4444; border-color: #ef4444; }

/* DTMF labeled ports — show digit inside the dot */
.flow-port.flow-port-labeled {
    width: 16px; height: 16px;
    font-size: 7px; font-weight: 900; color: #0c1526; font-family: monospace;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* Hover */
.flow-port.port-dir-in:hover  { background: #60a5fa; border-color: #60a5fa; transform: translateY(-50%) scale(1.4); box-shadow: 0 0 8px rgba(96,165,250,0.8); }
.flow-port.port-dir-out:hover { opacity: 0.8; transform: translateY(-50%) scale(1.4); box-shadow: 0 0 8px rgba(96,165,250,0.6); }
.flow-port.port-dir-out.port-type-gateway:hover { box-shadow: 0 0 8px rgba(148,163,184,0.6); }

/* Compatible / incompatible highlights during connection drawing */
.flow-port.port-compatible   { animation: pulseGreen 0.8s ease infinite; }
.flow-port.port-incompatible { opacity: 0.25; cursor: not-allowed; }
@keyframes pulseGreen { 0%,100%{ box-shadow: 0 0 0 0 rgba(74,222,128,0.6); } 50%{ box-shadow: 0 0 0 5px rgba(74,222,128,0); } }

/* ---- Properties Panel ---- */
.flow-properties {
    width: 215px; min-width: 215px;
    background: #13121f;
    border-left: 1px solid rgba(255,255,255,0.07);
    padding: 12px; overflow-y: auto;
    display: flex; flex-direction: column;
}

.properties-title {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35); padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07); margin-bottom: 12px;
}

.properties-empty { text-align: center; color: rgba(255,255,255,0.2); padding: 28px 8px; }
.properties-empty i { font-size: 1.8rem; margin-bottom: 8px; display: block; }
.properties-empty p { font-size: 0.8rem; margin: 0; line-height: 1.5; }

#propertiesForm .prop-node-type {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; margin-bottom: 12px; padding: 4px 8px;
    border-radius: 5px; display: inline-block; color: #fff;
}
#propertiesForm .form-group  { margin-bottom: 10px; }
#propertiesForm label        { font-size: 0.74rem; color: rgba(255,255,255,0.5); display: block; margin-bottom: 4px; }
#propertiesForm .formfld     { padding: 6px 8px; font-size: 0.8rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); border-radius: 6px; width: 100%; }
#propertiesForm .formfld:focus { border-color: #6C2BD9; background: rgba(108,43,217,0.1); outline: none; }
#propertiesForm select.formfld option { background: #1a1a2e; color: #fff; }

/* Audio upload */
.audio-upload-wrap { display: flex; flex-direction: column; gap: 6px; }
.audio-upload-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; background: rgba(108,43,217,0.15);
    border: 1px dashed rgba(108,43,217,0.5); border-radius: 7px;
    color: #a78bfa; font-size: 0.75rem; cursor: pointer; transition: all 0.15s;
}
.audio-upload-btn:hover { background: rgba(108,43,217,0.28); border-style: solid; }
.audio-upload-preview { padding: 6px 0; font-size: 0.72rem; color: rgba(255,255,255,0.5); }
.audio-upload-preview i { color: #a78bfa; margin-right: 4px; }
.audio-upload-preview audio { display: block; width: 100%; margin-top: 4px; height: 28px; filter: invert(0.8); }

/* Delete button in properties */
.prop-delete-btn { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.prop-delete-btn button {
    width: 100%; padding: 7px;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
    border-radius: 7px; color: #ef4444; font-size: 0.76rem; cursor: pointer; transition: all 0.15s;
}
.prop-delete-btn button:hover { background: rgba(239,68,68,0.25); }
