/* ============================================
   SHARED COMPONENTS
   Buttons, badges, chips, cards, tooltips,
   forms, toggles, color-picker, utilities
   ============================================ */

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s, opacity 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: var(--icon-sm);
    height: var(--icon-sm);
    flex-shrink: 0;
    stroke-width: 2;
}

.btn-icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
    flex-shrink: 0;
    stroke-width: 2;
}

.btn-primary {
    background: var(--badge-text);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-secondary);
    border-color: var(--border);
}

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

.btn-secondary:active:not(:disabled) {
    transform: scale(0.98);
}

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

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-danger:hover:not(:disabled) {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.btn-sm .btn-icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
}

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

.btn-reset {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-reset:hover:not(:disabled) {
    background: var(--background-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-reset svg {
    flex-shrink: 0;
}

.btn-icon-only {
    padding: 0;
    justify-content: center;
    width: var(--space-8);
    height: var(--space-8);
}

.btn-icon-only.btn-sm {
    width: var(--space-7);
    height: var(--space-7);
}

/* === Manager Card === */

.manager-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.manager-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--black-8);
    transform: translateY(-2px);
}

.manager-card.manager-inactive {
    opacity: 0.7;
    background: var(--danger-bg-subtle);
    border-color: var(--danger-color);
    border-width: 1px;
}

.manager-card.manager-inactive .manager-name {
    color: var(--danger-color);
}

/* === Status Toggle (compact pill badge) === */

.emp-status-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 99px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
}

.emp-status-toggle:hover {
    border-color: var(--accent-light);
    transform: scale(1.01);
}

.emp-status-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.emp-status-slider {
    position: relative;
    width: 30px;
    height: 18px;
    background: var(--border);
    border-radius: 999px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.emp-status-slider::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.emp-status-toggle input[type="checkbox"]:checked + .emp-status-slider {
    background: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(237, 137, 54, 0.2),
                0 0 0 3px var(--accent-glow);
}

.emp-status-toggle input[type="checkbox"]:checked + .emp-status-slider::after {
    transform: translateX(12px);
}

.emp-status-toggle-label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.25s ease;
    color: var(--text-secondary);
}

.emp-status-toggle input[type="checkbox"]:checked ~ .emp-status-toggle-label {
    color: var(--accent);
}

.emp-status-toggle:has(input[type="checkbox"]:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}

.emp-status-toggle:has(input[type="checkbox"]:disabled):hover {
    transform: none;
    border-color: var(--border);
}

.emp-status-toggle--neutral:hover { border-color: var(--primary-color); }
.emp-status-toggle--neutral input[type="checkbox"]:checked + .emp-status-slider {
    background: var(--primary-color);
    box-shadow: none;
}
.emp-status-toggle--neutral input[type="checkbox"]:checked ~ .emp-status-toggle-label {
    color: var(--primary-color);
}

/* === Color Picker (compact pill badge) === */

.emp-color-picker {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 99px;
    cursor: default;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.emp-color-picker:hover {
    border-color: var(--accent-light);
    transform: scale(1.01);
}

.emp-color-picker input[type="color"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 1px;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    background: var(--surface);
    box-shadow: 0 2px 4px var(--black-10);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.emp-color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.emp-color-picker input[type="color"]::-webkit-color-swatch {
    border-radius: 50%;
    border: none;
}

.emp-color-picker input[type="color"]:hover:not(:disabled) {
    border-color: var(--primary-color);
}

.emp-color-picker input[type="color"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
    outline: none;
}

.emp-color-picker input[type="color"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.emp-color-picker:has(input[type="color"]:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}

.emp-color-picker:has(input[type="color"]:disabled):hover {
    transform: none;
    border-color: var(--border);
}

.emp-color-picker__label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}

/* === Forms === */

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: var(--space-10);
    padding: 0 var(--space-4);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--primary-color);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%239ca3af' stroke-width='1.5' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 12px;
    padding-inline-end: var(--space-9);
}

.form-textarea {
    height: auto;
    min-height: calc(100px * var(--space-scale));
    padding: var(--space-2) var(--space-4);
    resize: vertical;
    field-sizing: content;
    overflow: hidden;
}



input.form-input:read-only,
.form-textarea:read-only,
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background: var(--background-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}


input[type="file"]::file-selector-button {
    padding: var(--space-2) var(--space-4);
    margin-inline-end: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

input[type="file"]::file-selector-button:hover {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

input[type="file"]::file-selector-button:active {
    transform: translateY(1px);
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-row--3col {
    grid-template-columns: 2fr 1.5fr 1.5fr;
}

.form-row--full {
    grid-template-columns: 1fr;
}

.form-row--full .form-field {
    min-width: 0;
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* === Toggle Switch === */

.toggle-inactive {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    user-select: none;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.toggle-inactive input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-inactive input[type="checkbox"] + span {
    position: relative;
    padding-inline-start: 44px;
    cursor: pointer;
    line-height: 20px;
}

.toggle-inactive input[type="checkbox"] + span::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 999px;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.toggle-inactive input[type="checkbox"] + span::after {
    content: '';
    position: absolute;
    inset-inline-start: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.toggle-inactive input[type="checkbox"]:checked + span::before {
    background: var(--primary-color);
}

.toggle-inactive input[type="checkbox"]:checked + span::after {
    transform: translateY(-50%) translateX(16px);
}

[dir="rtl"] .toggle-inactive input[type="checkbox"]:checked + span::after {
    transform: translateY(-50%) translateX(-16px);
}

.toggle-inactive:hover input[type="checkbox"] + span::before {
    box-shadow: inset 0 0 0 1px rgba(74, 85, 104, 0.2);
}

/* === Photo / Avatar === */
/* Unified circle style with solid primary placeholder */

.photo-wrapper {
    position: relative;
    flex-shrink: 0;
}

.photo-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.photo-avatar--sm  { width: var(--space-10);  height: var(--space-10); }
.photo-avatar--md  { width: calc(64px * var(--space-scale));  height: calc(64px * var(--space-scale)); }
.photo-avatar--lg  { width: calc(120px * var(--space-scale)); height: calc(120px * var(--space-scale)); }
.photo-avatar--xl  { width: calc(200px * var(--space-scale)); height: calc(200px * var(--space-scale)); }

.photo-placeholder {
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--text-2xl);
    flex-shrink: 0;
}

.photo-placeholder svg {
    width: 40%;
    height: 40%;
    color: white;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .photo-avatar--xl, .photo-placeholder.photo-avatar--xl { width: calc(150px * var(--space-scale)); height: calc(150px * var(--space-scale)); }
}

/* === Detail Grid === */

.detail-grid {
    display: grid;
    gap: var(--space-4);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.detail-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* === Info Rows === */

.info-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.info-icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
    stroke-width: 2;
    flex-shrink: 0;
}

.info-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* === Stat Cards === */

.stats-grid {
    display: grid;
    gap: var(--space-5);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Stat item (simplified variant, e.g. profile) */
.stat-item {
    text-align: center;
    padding: var(--space-5);
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
}

/* === Data Tables === */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--background-secondary);
}

.data-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

[dir="rtl"] .data-table th {
    text-align: right;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--background-secondary);
}

/* Centered variant (expenses, notifications) */
.data-table--centered th,
.data-table--centered td {
    text-align: center;
}

/* Primary header variant */
.data-table--primary-header thead {
    background: var(--primary-color);
}

.data-table--primary-header th {
    color: white;
    border-bottom: none;
}

/* Zebra striping */
.data-table--striped tbody tr:nth-child(even) {
    background: var(--black-4);
}

/* Table container with card styling */
.data-table-container {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* === Filter Components === */

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.filter-icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
    stroke-width: 2;
    flex-shrink: 0;
}

.filter-input {
    width: 100%;
    height: var(--space-10);
    padding: 0 var(--space-4);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input:hover {
    border-color: var(--primary-color);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

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

.filter-select {
    width: 100%;
    min-width: 0;
    min-height: var(--space-10);
    padding-block: var(--space-3);
    padding-inline: var(--space-3) var(--space-8);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

[dir="rtl"] .filter-select {
    background-position: left 0.75rem center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.filter-actions .toggle-inactive {
    margin-inline-end: auto;
}

/* === Badges === */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-xs);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1;
}

.badge--pill {
    border-radius: var(--space-3);
}

.badge--success {
    color: var(--alert-success-icon);
    background: var(--alert-success-bg);
}

.badge--danger {
    color: var(--alert-error-icon);
    background: var(--alert-error-bg-light);
}

.badge--warning {
    color: var(--alert-warning-icon);
    background: var(--alert-warning-bg-light);
}

.badge--info {
    color: var(--alert-info-icon);
    background: var(--alert-info-bg);
}

.badge--neutral {
    background: var(--badge-bg);
    color: var(--badge-text);
}

.badge--dark {
    background: var(--badge-dark-bg);
    color: var(--badge-dark-text);
}

.badge--outlined.badge--danger {
    border: 1px solid var(--danger-border-light);
}

.badge--outlined.badge--warning {
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Count badge (pill, primary) */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: calc(22px * var(--space-scale));
    height: calc(22px * var(--space-scale));
    padding: 0 var(--space-2);
    background: var(--primary-color);
    color: white;
    border-radius: calc(11px * var(--space-scale));
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

/* Inactive badge (danger, lowercase) */
.inactive-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--danger-color);
    background: var(--danger-bg);
    border-radius: var(--radius-xs);
    text-transform: lowercase;
    white-space: nowrap;
    flex-shrink: 0;
}

/* === Card === */

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card--hoverable:hover {
    box-shadow: var(--shadow-lg);
}

/* === Chip === */

.chip {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 500;
}

.chip--info {
    background: linear-gradient(135deg, var(--alert-info-bg) 0%, #bfdbfe 100%);
    color: var(--info-color);
    border: 1px solid rgba(30, 64, 175, 0.1);
}

.chip--danger {
    background: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    opacity: 0.8;
}

/* === Tooltip === */

.tooltip-fixed {
    position: fixed;
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    white-space: pre-wrap;
    max-width: 250px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 12px var(--black-15);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.tooltip-fixed.visible {
    opacity: 1;
}

/* === Form Field === */

.form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    margin-bottom: var(--space-5);
}

.form-field:last-of-type {
    margin-bottom: 0;
}

.form-row .form-field {
    margin-bottom: 0;
}

/* === Form Checkbox === */

.form-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-primary);
    user-select: none;
}

.form-checkbox {
    width: var(--icon-sm);
    height: var(--icon-sm);
    cursor: pointer;
    accent-color: var(--accent);
}

.form-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* === Checkbox Group === */

.checkbox-group {
    max-height: calc(200px * var(--space-scale));
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    background: var(--background-secondary);
    margin-top: var(--space-1);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: var(--space-1);
}

.checkbox-item:last-child {
    margin-bottom: 0;
}

.checkbox-item:hover {
    background: var(--border-light);
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: var(--icon-sm);
    height: var(--icon-sm);
    accent-color: var(--accent);
}

.checkbox-item span {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: 1.4;
}

/* === Required Marker === */

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
    font-weight: 700;
}

/* === Form Error === */

.form-error {
    color: var(--danger-color);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

.form-field-error {
    font-size: var(--text-sm);
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--alert-error-bg-light);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger-color);
}

/* === Form Hint === */

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* === Hidden === */

.hidden {
    display: none !important;
}

/* === Responsive === */

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

    .checkbox-group {
        max-height: calc(150px * var(--space-scale));
        padding: var(--space-2);
    }

    .checkbox-item {
        padding: var(--space-1);
        margin-bottom: calc(2px * var(--space-scale));
    }
}

@media (max-width: 576px) {
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }
}

/* ===== Star Rating ===== */

.star-rating-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.star-rating {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.star-item {
    position: relative;
    cursor: pointer;
    width: var(--space-8);
    height: var(--space-8);
    transition: transform 0.2s ease;
}

.star-item:hover {
    transform: scale(1.15);
}

.star-item:active {
    transform: scale(0.95);
}

.star-half-left,
.star-half-right {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 10;
}

.star-half-left {
    left: 0;
}

.star-half-right {
    right: 0;
}

.star-icon {
    width: var(--space-8);
    height: var(--space-8);
    transition: all 0.2s ease;
}

.star-icon.star-empty {
    fill: none;
    stroke: hsl(45, 93%, 47%);
    stroke-width: 1.5;
}

.star-icon.star-filled {
    fill: hsl(45, 93%, 47%);
    stroke: hsl(45, 93%, 47%);
    stroke-width: 1.5;
}

.star-icon.star-half {
    fill: url(#halfStarGradient);
    stroke: hsl(45, 93%, 47%);
    stroke-width: 1.5;
}

.star-rating--readonly {
    pointer-events: none;
}

.star-rating--readonly .star-icon {
    width: var(--space-5);
    height: var(--space-5);
}

.star-rating-value {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    min-width: var(--space-12);
    text-align: left;
}

/* === Django Filer Widget === */

.filer-dropzone {
    background: var(--background-secondary) !important;
    border: 2px dashed var(--border) !important;
    border-radius: var(--radius-md) !important;
    padding: var(--space-6) !important;
    transition: border-color 0.2s, background 0.2s;
}

.filer-dropzone:hover {
    border-color: var(--primary-color) !important;
    background: var(--surface) !important;
}

form .form-row .filer-dropzone .dz-message {
    color: var(--text-primary) !important;
    font-size: var(--text-sm);
}

form .form-row .filer-dropzone .dz-message .icon {
    color: var(--text-primary) !important;
}

form .form-row .filer-dropzone .filerFile .related-lookup.lookup {
    display: inline-flex !important;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) !important;
    background: var(--badge-text) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
}

form .form-row .filer-dropzone .filerFile .related-lookup.lookup:hover {
    background: var(--primary-color) !important;
    transform: translateY(-1px);
}

.filer-dropzone .filerClearer {
    color: var(--danger-color);
}

.filer-dropzone .dz-name {
    font-size: var(--text-sm);
    color: var(--text-primary);
}
