/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.form-label .required {
    color: var(--error);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-row > .form-group {
    min-width: 0;
}

.form-input,
.form-select {
    min-width: 0;
}

.form-actions {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field .form-input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    cursor: pointer;
}

.password-toggle:active {
    color: var(--primary);
    border-color: var(--primary);
}

.temp-warning {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(217, 119, 6, 0.35);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.billing-placeholder-body {
    opacity: 0.55;
    pointer-events: none;
}

.activity-code-field {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
}

.activity-name-field {
    flex: 3;
    min-width: 220px;
}

.section-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.reset-bar {
    margin: 0.5rem 0 1rem;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.admin-tab {
    border: 1px solid transparent;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-tab.is-active {
    background: white;
    border-color: var(--border);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.admin-panel {
    display: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.admin-panel-active {
    display: block;
}

.admin-table-wrap {
    margin-top: 1.25rem;
}

.admin-confirm-panel {
    margin-top: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

@media (max-width: 720px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Settings tabs */
.settings-card .card-body {
    display: grid;
    gap: 1.25rem;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
}

.settings-tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-tab.active {
    background: white;
    border-color: var(--border);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr[data-billing-row],
.data-table tbody tr[data-user-row] {
    cursor: pointer;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(26, 54, 93, 0.04);
}

.data-table tbody tr.is-selected {
    background: rgba(26, 54, 93, 0.08);
}

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

/* File Upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(26, 54, 93, 0.02);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: rgba(26, 54, 93, 0.05);
}

.file-upload.has-file {
    border-color: var(--success);
    background: var(--success-bg);
}

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

.file-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.file-upload-text strong {
    color: var(--primary);
}

.file-name {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--success);
    word-break: break-all;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--bg);
    color: var(--error);
    border: 2px solid rgba(220, 38, 38, 0.4);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: white;
    box-shadow: var(--shadow);
}

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Status Messages */
.status {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.status-info {
    background: rgba(26, 54, 93, 0.1);
    color: var(--primary);
}

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

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

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

/* Extracted Data Display */
.extracted-data {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.extracted-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.extracted-item:last-child {
    border-bottom: none;
}

.extracted-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.extracted-value {
    font-size: 0.875rem;
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

.extracted-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Section Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Optional Assets Section */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.asset-upload {
    position: relative;
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.asset-upload:hover {
    border-color: var(--primary);
}

.asset-upload.has-file {
    border-style: solid;
    border-color: var(--success);
}

.asset-upload input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.asset-upload img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
}

.asset-upload-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 0.25rem;
}

.asset-upload .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.asset-upload.has-file .remove-btn {
    display: flex;
}

/* Preview Section */
.preview-section {
    background: var(--primary-dark);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.preview-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.preview-content {
    font-size: 0.8125rem;
    line-height: 1.7;
    opacity: 0.85;
}

.preview-content strong {
    color: var(--accent-light);
}

/* Branch selection */
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    user-select: none;
}

.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.branches-list {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.branch-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
}

.branch-item:last-child {
    border-bottom: none;
}

.branch-meta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.branch-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.branch-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Collapsible */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.75rem 0;
}

.collapsible-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.collapsible-content {
    display: none;
    padding-top: 0.5rem;
}

.collapsible-content.open {
    display: block;
}

.chevron {
    transition: transform 0.2s;
}

.chevron.open {
    transform: rotate(180deg);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 2rem);
    max-width: 400px;
}

.toast {
    background: var(--primary-dark);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    animation: slideUp 0.3s ease;
}

.toast.error {
    background: var(--error);
}

.toast.success {
    background: var(--success);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Chip */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Hide number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}
.backend-banner {
    width: 100%;
    background: #b91c1c;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
