/* ── Design tokens ── */
:root {
    --brand-primary: #2940B0;
    --brand-primary-hover: #1e3299;
    --brand-primary-light: rgba(41, 64, 176, 0.08);
    --brand-success: #22c55e;
    --brand-danger: #ef4444;
    --surface-bg: #f4f6fb;
    --surface-card: #ffffff;
    --border-color: #e5e7eb;
    --border-focus: #2940B0;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --input-height: 42px;
    --transition: 0.2s ease;
}

/* ── Form controls ── */
.form-control {
    height: var(--input-height);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background-color: var(--surface-card);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control-sm {
    height: 36px;
    font-size: 0.875rem;
}

textarea.form-control {
    height: auto;
    min-height: 100px;
    padding: 0.75rem 0.875rem;
    line-height: 1.5;
}

select.form-control {
    cursor: pointer;
    appearance: auto;
}

.form-control:hover:not(:disabled):not([readonly]) {
    border-color: #cbd5e1;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(41, 64, 176, 0.12);
    outline: none;
}

.form-control[readonly],
.form-control:disabled {
    background-color: #f9fafb;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ── Buttons ── */
.btn-my-primary {
    background-color: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.625rem 1.25rem;
    height: var(--input-height);
    line-height: 1.2;
    transition: background-color var(--transition), transform 0.1s, box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-my-primary:hover,
.btn-my-primary:focus {
    background-color: var(--brand-primary-hover) !important;
    color: #fff !important;
    box-shadow: var(--shadow-md);
}

.btn-my-primary:active {
    transform: scale(0.98);
}

.btn-success {
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* ── Card / panel base ── */
.form-card,
.form-panel,
#company-info-box,
#setting-security-box,
#change-password-box,
#two-factor-auth-box,
#live-chat-box,
#manage-project-box,
#manage-task-pin-box,
#manage-user-and-access-box {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

/* ── Form layout helpers ── */
.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-primary-light);
}

.form-row-modern {
    margin-bottom: 1rem;
    align-items: center;
}

.form-row-modern > [class*="col-md-"]:first-child {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row-modern label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

html[dir="rtl"] .form-actions {
    justify-content: flex-start;
}

/* ── Search / filter toolbar ── */
.filter-toolbar {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.filter-toolbar label,
.filter-toolbar h6 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.375rem;
}

/* ── Compose layout (Project / TaskPin) ── */
#project-index > .row > div,
#task-pin-index > .row > div {
    padding: 0 0.375rem;
}

#project-index > .row > div > div,
#task-pin-index > .row > div > div {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: 100%;
    margin: auto;
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow var(--transition);
}

#project-index > .row > div > div:hover,
#task-pin-index > .row > div > div:hover {
    box-shadow: var(--shadow-md);
}

#project-index > .row > div > div h5,
#task-pin-index > .row > div > div h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: 1rem;
}

.row-flex {
    display: flex;
    flex-wrap: wrap;
}

.row-flex > div > div {
    height: 100%;
}

#pin-title-label {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #3b52c4 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-md);
    width: 100%;
    margin: auto;
}

/* ── Auth pages ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #eef2ff 0%, var(--surface-bg) 50%, #f0fdf4 100%);
}

#login-page,
#signup-page {
    width: 100%;
    max-width: 960px;
    margin: auto;
}

#login-box {
    display: flex;
    flex-wrap: wrap;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#login-box > div {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    display: block !important;
}

#login-box > div:first-child {
    flex: 1 1 340px;
    padding: 2.5rem !important;
    background: var(--surface-card) !important;
}

#login-box > div:last-child {
    flex: 1 1 340px;
    background: linear-gradient(160deg, var(--brand-primary-light) 0%, #eef2ff 100%) !important;
    display: flex !important;
    align-items: center;
}

#login-box > div:last-child > div {
    padding: 2.5rem;
}

#login-box form img,
#login-box > div:last-child img {
    max-width: 180px;
    margin-bottom: 1.5rem;
}

#login-box .form-control,
#signup-page .form-control {
    height: var(--input-height);
    margin-bottom: 1rem;
}

#login-box .btn-primary,
#signup-page .btn-my-primary {
    height: var(--input-height);
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

#signup-page {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    max-width: 960px;
    width: 100%;
    min-height: auto;
    height: auto;
    margin-top: 2rem !important;
    margin-bottom: 2rem;
}

#signup-page input,
#signup-page select {
    height: var(--input-height);
}

/* ── Password / security form ── */
#change-password-box {
    max-width: 420px;
    height: auto !important;
}

#change-password-box label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

#change-password-box small {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

#change-password-box p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ── Live chat ── */
#live-chat-box {
    max-width: 640px;
    border: none !important;
}

#txa-user-question {
    resize: vertical;
    min-height: 140px;
}

/* ── Company info scroll area ── */
#company-info-box {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* ── Checkbox / radio styling ── */
input[type="checkbox"],
input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

input[type="radio"] + label,
input[type="checkbox"] + label {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-left: 0.375rem;
    vertical-align: middle;
}

html[dir="rtl"] input[type="radio"] + label,
html[dir="rtl"] input[type="checkbox"] + label {
    margin-left: 0;
    margin-right: 0.375rem;
}

/* ── Tables in forms ── */
.form-card table,
#manage-project-box table,
#manage-task-pin-box table {
    font-size: 0.875rem;
}

.form-card table th {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-weight: 600;
    border: none;
    padding: 0.75rem;
}

.form-card table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

/* ── Alert styling ── */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9375rem;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}

#txt-project-description {
    min-height: 140px;
    resize: vertical;
}

/* ── Reset password ── */
#reset-password-box {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

#reset-password-box > div {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

#reset-password-box img {
    max-width: 160px;
    margin-bottom: 1rem;
}

#reset-password-box h4 {
    color: var(--brand-primary);
    font-weight: 700;
}

#reset-password-box p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    #login-box > div:first-child,
    #login-box > div:last-child {
        flex: 1 1 100%;
    }

    #live-chat-box {
        width: 100% !important;
        max-width: 100%;
    }

    #company-info-box .col-md-3 {
        margin-top: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}
