:root {
    --white: #ffffff;
    --bg: #fafbfc;
    --surface: #ffffff;
    --border: #e8ecf0;
    --border-light: #f0f2f5;
    --primary: #1a3a6b;
    --primary-hover: #15305a;
    --accent: #c9a227;
    --text: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --success: #38a169;
    --error: #e53e3e;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 1px 8px rgba(0,0,0,0.06);
    --sidebar-width: 260px;
    --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Tajawal', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color var(--transition); }
a:hover { color: var(--primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 32px; }

/* ─── BUTTONS ─── */
.min-btn, .mx-btn, .neu-btn {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--white);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.min-btn:hover, .mx-btn:hover, .neu-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.min-btn-primary, .mx-btn-primary, .neu-btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.min-btn-primary:hover, .mx-btn-primary:hover, .neu-btn-primary:hover {
    background: var(--primary-hover);
    color: var(--white);
    border-color: var(--primary-hover);
}

.min-btn-accent, .mx-btn-gold, .neu-btn-gold {
    background: var(--white);
    color: var(--primary);
    border-color: var(--accent);
}

.min-btn-accent:hover, .mx-btn-gold:hover, .neu-btn-gold:hover {
    background: var(--accent);
    color: var(--white);
}

/* ─── INPUTS ─── */
.min-input, .mx-input, .neu-input {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 16px;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.min-input:focus, .mx-input:focus, .neu-input:focus {
    border-color: var(--primary);
}

.min-input::placeholder, .mx-input::placeholder, .neu-input::placeholder { color: var(--text-muted); }

/* ─── FILE UPLOAD ─── */
.file-upload-box {
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--bg);
}
.file-upload-input {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
}
.file-upload-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.file-upload-current {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.file-upload-preview {
    display: block;
    max-width: 200px;
    max-height: 140px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

/* ─── CARDS ─── */
.min-card, .mx-card, .neu-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.min-card::before, .min-card::after,
.mx-card::before, .mx-card::after,
.neu-card::before, .neu-card::after { display: none; }

.min-card-sm, .mx-card-sm, .neu-card-sm, .stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow var(--transition);
}

.min-card-sm:hover, .mx-card-sm:hover, .neu-card-sm:hover, .stat-card:hover {
    box-shadow: var(--shadow);
}

.min-icon, .mx-icon, .neu-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border-light);
    font-size: 18px;
    color: var(--primary);
}

/* ─── NAVBAR ─── */
.navbar {
    padding: 20px 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.landing-nav .container { position: relative; }
.nav-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-mobile-login { display: none; }
.logo img { height: 48px; }

.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover { color: var(--primary); }

/* ─── HERO ─── */
.hero {
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/images/landing-hero-courthouse.png') center center / cover no-repeat;
    opacity: 0.2;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.55) 0%, rgba(239, 246, 255, 0.72) 55%, rgba(248, 250, 252, 0.82) 100%);
    pointer-events: none;
}

.hero > .container {
    position: relative;
    z-index: 1;
}

.hero-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 40px;
    font-weight: 400;
}

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ─── SECTIONS ─── */
.section { padding: 80px 0; }

.section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 12px;
}

.section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 56px;
    font-size: 15px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.feature-card { text-align: right; }
.feature-card .min-icon, .feature-card .mx-icon { margin-bottom: 16px; }
.feature-card h3 { color: var(--text); margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.feature-card p { color: var(--text-muted); font-size: 14px; line-height: 1.7; }

/* ─── PRICING ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.pricing-card { text-align: right; }
.pricing-card.popular { border-color: var(--primary); box-shadow: var(--shadow); }

.popular-badge, .hero-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(26,58,107,0.06);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.pricing-card h3 { color: var(--text); font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.pricing-card .price { font-size: 2.2rem; font-weight: 700; color: var(--primary); margin: 20px 0 4px; }
.pricing-card .price span { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.pricing-card .price-yearly { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.pricing-features { list-style: none; margin: 0 0 28px; }
.pricing-features li {
    padding: 10px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.pricing-features li::before { content: '— '; color: var(--text-muted); }

/* ─── DASHBOARD ─── */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-left: 1px solid var(--border);
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}

.sidebar::before { display: none; }

.sidebar-logo {
    padding: 28px 24px 24px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo img { height: 52px; }
.sidebar-logo::after { display: none; }

.sidebar-nav { padding: 16px 12px; }

.sidebar-nav a {
    display: block;
    padding: 10px 16px;
    margin-bottom: 2px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 14px;
    transition: all var(--transition);
}

.sidebar-nav a:hover { color: var(--primary); background: var(--bg); }
.sidebar-nav a.active {
    color: var(--primary);
    background: rgba(26,58,107,0.06);
    font-weight: 600;
}

.sidebar-nav .icon { display: none; }

.sidebar-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.sidebar-section-title {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 16px 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 40px 48px;
    max-width: calc(100% - var(--sidebar-width));
}

.top-bar, .neu-flat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.top-bar::before { display: none; }

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.page-ornament, .mx-divider { display: none; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card { text-align: right; }
.stat-card .stat-icon { display: none; }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
    background: none;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    font-weight: 400;
}

/* ─── TABLE ─── */
.min-table, .mx-table, .neu-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.min-table th, .mx-table th, .neu-table th {
    text-align: right;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
}

.min-table td, .mx-table td, .neu-table td {
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 14px;
    box-shadow: none;
    border-radius: 0 !important;
}

.min-table tr:hover td, .mx-table tr:hover td, .neu-table tr:hover td {
    background: var(--bg);
    color: var(--text);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
}

.badge-gold { background: rgba(201,162,39,0.1); color: #92710a; }
.badge-green { background: rgba(56,161,105,0.1); color: var(--success); }
.badge-red { background: rgba(229,62,62,0.1); color: var(--error); }
.badge-blue { background: var(--primary-light); color: var(--primary); }

.page-head-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
    font-weight: 500;
}

.case-stage-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.case-stage-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
    text-align: center;
}

.case-stage-card:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    transform: translateY(-1px);
}

.case-stage-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.case-stage-icon { font-size: 22px; line-height: 1; }

.case-stage-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.case-stage-sublabel {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.case-stage-count {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-dark);
}

.case-stage-card.active .case-stage-count { color: var(--primary); }

.badge-stage {
    text-decoration: none;
    font-weight: 600;
}

.badge-stage-execution { background: #fef3c7; color: #b45309; }
.badge-stage-appeals { background: #e0f2fe; color: #0369a1; }
.badge-stage-cassation { background: #ffe4e6; color: #be123c; }

.badge-stage:hover { opacity: 0.85; }

.client-select-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.client-select-head label { margin-bottom: 0; }

.client-select-add-btn {
    font-size: 12px;
    padding: 6px 10px;
    white-space: nowrap;
}

.client-select-search {
    margin-bottom: 8px;
}

.client-combobox {
    position: relative;
}

.client-combobox-input {
    width: 100%;
}

.client-combobox-list {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 40;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.client-combobox-list[hidden] {
    display: none !important;
}

.client-combobox-option {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}

.client-combobox-option:hover,
.client-combobox-option.is-active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.client-select-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

body.mizan-modal-open { overflow: hidden; }

.mizan-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mizan-modal[hidden] { display: none !important; }

.mizan-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.mizan-modal-dialog {
    position: relative;
    width: min(100%, 480px);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}

.mizan-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
}

.mizan-modal-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.mizan-modal-close {
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.mizan-modal-body { padding: 18px; }

.mizan-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ─── CALENDAR ─── */
.calendar-page-top {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.calendar-form-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.calendar-form-head h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.calendar-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.calendar-panel-full {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px 28px;
    box-shadow: var(--shadow-sm);
    margin-top: 24px;
}

.calendar-month-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-month-head h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.calendar-month-head a {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    padding: 10px 4px;
}

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-grid-full { gap: 8px; }

.calendar-day {
    aspect-ratio: 1.15;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg);
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

.calendar-day-num { font-weight: 600; font-size: 15px; }

.calendar-day-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
}

.calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.calendar-day:hover { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.calendar-day.has-event { border-color: #bfdbfe; background: #eff6ff; color: var(--primary-dark); }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.calendar-day.today .calendar-dot { background: white !important; }

.calendar-day-btn {
    font: inherit;
    width: 100%;
    padding: 0;
}

.calendar-day-btn.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.calendar-day-btn.today.is-selected {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 4px 12px rgba(37, 99, 235, 0.35);
}

.calendar-day-panel {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.calendar-day-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.calendar-day-panel-head h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.calendar-day-panel-close {
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.calendar-day-panel-close:hover {
    background: var(--border-light);
    color: var(--text);
}

.calendar-day-panel-empty {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

.calendar-day-event-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
}

.calendar-day-event-card:last-child { margin-bottom: 0; }

.calendar-day-event-card:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.calendar-day-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--event-color, var(--primary));
    flex-shrink: 0;
    margin-top: 5px;
}

.calendar-day-event-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.calendar-day-event-meta {
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .calendar-page-top { grid-template-columns: 1fr; }
    .calendar-form-grid { grid-template-columns: 1fr; }
    .calendar-day { min-height: 52px; aspect-ratio: 1; }
}

.event-list { margin-top: 24px; }

.event-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    background: none;
    border-radius: 0;
}

.event-item:hover { border-color: var(--border); }
.event-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }

/* ─── LOGIN ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--bg);
}

.login-page::before { display: none; }

.login-card { width: 100%; max-width: 400px; }
.login-card .logo { margin-bottom: 32px; text-align: center; }
.login-card .logo img { height: 72px; }
.login-card h2 { color: var(--text); margin-bottom: 6px; font-size: 1.4rem; font-weight: 700; text-align: center; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 32px; text-align: center; font-size: 14px; }

.form-group { margin-bottom: 20px; text-align: right; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text-secondary); font-size: 13px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group-full { grid-column: 1 / -1; }

.form-page {
    width: 100%;
    max-width: none;
}

.form-page .page-head h3 {
    font-size: 1.15rem;
}

.form-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.mizan-editor-wrap .ck-editor {
    width: 100%;
}

.mizan-editor-wrap .ck-editor__editable {
    min-height: 220px;
    direction: rtl;
    text-align: right;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

.mizan-editor-wrap .ck.ck-toolbar {
    direction: rtl;
}

.rich-text-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.rich-text-content p { margin: 0 0 0.75em; }
.rich-text-content p:last-child { margin-bottom: 0; }
.rich-text-content ul,
.rich-text-content ol { margin: 0 0 0.75em; padding-right: 1.25em; }
.rich-text-content li { margin-bottom: 0.35em; }
.rich-text-content strong,
.rich-text-content b { font-weight: 700; }
.rich-text-content em,
.rich-text-content i { font-style: italic; }
.rich-text-content u { text-decoration: underline; }
.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4 {
    margin: 0.9em 0 0.45em;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
}
.rich-text-content h2 { font-size: 1.2em; }
.rich-text-content h3 { font-size: 1.1em; }
.rich-text-content h4 { font-size: 1.05em; }
.rich-text-content blockquote {
    margin: 0 0 0.75em;
    padding: 0.5em 1em;
    border-right: 3px solid var(--border);
    color: var(--text-muted);
    background: var(--surface-2, #f8fafc);
    border-radius: 0 8px 8px 0;
}
.rich-text-content a { color: var(--primary, #1d4ed8); text-decoration: underline; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-head-title { display: flex; align-items: center; gap: 12px; }
.page-head-title h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }

.list-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}
.list-search-input {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}

.table-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-actions form { display: inline; }

.min-btn-danger {
    background: #fff;
    color: var(--error);
    border-color: rgba(239,68,68,0.35);
}
.min-btn-danger:hover { background: rgba(239,68,68,0.08); color: var(--error); }

.alert-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

.pagination-wrap { margin-top: 24px; }
.pagination-wrap nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination-wrap a,
.pagination-wrap span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--surface, #fff);
    text-decoration: none;
    line-height: 1.2;
}
.pagination-wrap a:hover { background: var(--primary-light); color: var(--primary); }
.pagination-wrap span[aria-current="page"] { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }
.pagination-wrap span[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.pagination-wrap svg { display: none !important; }

@media (max-width: 768px) {
    .form-grid-2 { grid-template-columns: 1fr; }
    .login-page {
        min-height: 100dvh;
        padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
        align-items: flex-start;
        padding-top: max(28px, env(safe-area-inset-top));
    }
    .login-card { margin-top: 8px; }
    .form-page .page-head {
        flex-direction: column;
        align-items: stretch;
    }
    .form-page .page-head .min-btn {
        width: 100%;
        justify-content: center;
    }
    .form-page-actions .min-btn {
        width: 100%;
        justify-content: center;
    }
    .mizan-editor-wrap .ck-editor__editable {
        min-height: 180px;
    }
    .client-select-head {
        flex-direction: column;
        align-items: stretch;
    }
    .client-select-add-btn { width: 100%; }
    .mizan-modal-actions .min-btn { width: 100%; justify-content: center; }
}

/* ─── ENTITY VIEW / TABS / SMART LINKS ─── */
.entity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.entity-header-main { flex: 1; min-width: 240px; }
.entity-back { font-size: 13px; color: var(--text-muted); display: inline-block; margin-bottom: 10px; font-weight: 600; }
.entity-back:hover { color: var(--primary); }

.entity-header-title { display: flex; align-items: flex-start; gap: 14px; }
.entity-header-title h2 { font-size: 1.35rem; font-weight: 800; color: var(--text); margin: 0 0 4px; line-height: 1.3; }
.entity-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; }

.entity-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.entity-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin: -8px 0 20px;
    padding: 10px 14px;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.record-meta-item { display: flex; align-items: center; gap: 6px; }
.record-meta-icon { font-size: 12px; }
.record-meta-text strong { color: var(--text); font-weight: 600; }
.record-meta-time {
    font-family: var(--font-mono, monospace);
    color: var(--text);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 11.5px;
    direction: ltr;
}

.entity-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
    padding-bottom: 0;
}

.entity-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    border-radius: 8px 8px 0 0;
}

.entity-tab:hover { color: var(--primary); background: var(--primary-light); }
.entity-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); background: var(--primary-light); }

.tab-icon { font-size: 15px; }
.tab-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    min-width: 20px;
    text-align: center;
}

.entity-tab.active .tab-count { background: var(--primary-dark); }

.smart-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.smart-link:hover { color: var(--primary-dark); text-decoration: underline; }
.smart-link-muted { color: var(--text-secondary); font-weight: 500; }
.smart-link-count {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px 24px;
    margin: 0;
}

.detail-item dt {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-item dd {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
    margin: 0;
}

.detail-full-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.detail-full-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
    margin: 0 0 14px;
}

.detail-full-body {
    width: 100%;
    max-width: none;
    margin-top: 4px;
    padding: 16px 18px;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.related-section { margin-top: 8px; }
.related-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}
.related-section-head h4 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }

.court-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}
.court-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.court-card-link .case-count-badge {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: 6px;
}

.table-link { color: var(--primary); font-weight: 600; }
.table-link:hover { text-decoration: underline; }

.action-view { background: var(--primary-light); color: var(--primary-dark); border-color: #bfdbfe; }
.action-view:hover { background: #dbeafe; }

.inline-add-form {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.alert-error {
    background: rgba(229,62,62,0.06);
    border: 1px solid rgba(229,62,62,0.2);
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(56,161,105,0.06);
    border: 1px solid rgba(56,161,105,0.2);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.demo-box, .neu-pressed {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    margin-top: 24px;
}

/* ─── FOOTER ─── */
.footer {
    text-align: center;
    padding: 48px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    background: var(--white);
}

.footer img { height: 40px; margin-bottom: 16px; filter: none; }

/* ─── PERMISSION MATRIX ─── */
.permission-matrix { width: 100%; font-size: 13px; }
.permission-matrix th { background: var(--bg); color: var(--text-muted); font-weight: 600; text-align: center; padding: 10px 8px; }
.permission-matrix td { text-align: center; padding: 8px; border-bottom: 1px solid var(--border); }
.permission-matrix td:first-child { text-align: right; font-weight: 500; color: var(--text); }
.permission-matrix input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ─── FIRM LOGO & DATA SCOPE ─── */
.sidebar-firm-logo { max-height: 56px; max-width: 140px; object-fit: contain; display: block; margin: 0 auto; }
.sidebar-firm-name { text-align: center; font-size: 12px; font-weight: 600; color: var(--text); margin-top: 8px; line-height: 1.4; }
.firm-logo-img { max-height: 96px; max-width: 200px; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--border); padding: 8px; background: var(--white); }
.firm-logo-placeholder { font-size: 48px; line-height: 1; }
.data-scope-modes { display: flex; flex-wrap: wrap; gap: 12px; }
.data-scope-radio { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); cursor: pointer; }
.data-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.data-scope-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; }

/* ─── ENCYCLOPEDIA ─── */
.encyclopedia-result-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}
.encyclopedia-result-row:hover { background: var(--bg); }
.encyclopedia-result-row:last-child { border-bottom: none; }
.encyclopedia-content {
    font-size: 15px;
    line-height: 1.95;
    color: var(--text);
    word-break: break-word;
}
.encyclopedia-content.is-plain-text { white-space: pre-wrap; }
.encyclopedia-content:not(.is-plain-text) { white-space: normal; }
.encyclopedia-content p { margin: 0 0 1em; }
.encyclopedia-content p:last-child { margin-bottom: 0; }
.encyclopedia-content ul,
.encyclopedia-content ol { margin: 0 0 1em; padding-right: 1.5em; }
.encyclopedia-content li { margin-bottom: 0.35em; }
.encyclopedia-content h2,
.encyclopedia-content h3,
.encyclopedia-content h4 { margin: 1.2em 0 0.55em; font-weight: 700; line-height: 1.5; }
.encyclopedia-content blockquote {
    margin: 0 0 1em;
    padding: 10px 14px;
    border-right: 3px solid var(--primary);
    background: var(--bg);
    border-radius: 8px;
}

/* علامة مائية خفيفة لمحتوى الموسوعة (نص + PDF) */
.mizan-watermarked {
    position: relative;
    isolation: isolate;
}
.mizan-watermarked > .mizan-watermark-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: url('/images/mizan-watermark.png') center center / min(48%, 280px) no-repeat;
    opacity: 0.09;
    mix-blend-mode: multiply;
}
.mizan-watermarked > .mizan-watermarked-body {
    position: relative;
    z-index: 1;
}
.pdf-viewer-frame-wrap.mizan-watermarked > .mizan-watermark-layer {
    mix-blend-mode: normal;
    opacity: 0.07;
}
.pdf-viewer-frame-wrap.mizan-watermarked .pdf-native-frame {
    position: relative;
    z-index: 1;
}

/* محتوى Google Sites المنسّق */
.encyclopedia-content.mf-google-sites,
.mf-google-sites {
    direction: rtl;
    text-align: right;
}
.mf-google-sites .mf-sites-heading {
    margin: 1.1em 0 0.5em;
    font-weight: 700;
    line-height: 1.55;
    color: var(--primary);
}
.mf-google-sites .mf-sites-paragraph {
    margin: 0 0 0.85em;
    line-height: 1.95;
}
.mf-google-sites .mf-sites-pages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}
.mf-google-sites .mf-sites-figure {
    margin: 0;
    text-align: center;
}
.mf-google-sites .mf-sites-figure img {
    display: block;
    width: 100%;
    max-width: 920px;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.ency-content-viewer { display: flex; flex-direction: column; gap: 14px; }
.ency-content-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.ency-content-search-bar .ency-search-input { flex: 1; min-width: 180px; }
.ency-search-status { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-inline-start: auto; }
mark.ency-search-mark {
    background: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}
mark.ency-search-mark-active {
    background: #facc15;
    outline: 2px solid #ca8a04;
}

/* ─── LANDING PAGE ─── */
.landing-protection { background: linear-gradient(180deg, var(--white) 0%, var(--bg) 100%); }

.protection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.protection-lead {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.9;
    margin: 16px 0 24px;
}

.protection-points {
    list-style: none;
    margin: 0;
    padding: 0;
}

.protection-points li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 15px;
}

.protection-image {
    width: 100%;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* ─── FREE TRIAL SECTION ─── */
.landing-trial {
    background: linear-gradient(180deg, var(--bg) 0%, var(--white) 100%);
}

.trial-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 48px;
    align-items: center;
}

.trial-ribbon {
    display: inline-block;
    background: rgba(201, 162, 39, 0.14);
    color: #9a7b12;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.trial-lead {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.9;
    margin: 12px 0 22px;
    text-align: right;
}

.trial-points {
    list-style: none;
    margin: 0;
    padding: 0;
}

.trial-points li {
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 15px;
    text-align: right;
}

.trial-form-card {
    padding: 32px 28px;
}

.trial-form-card h3 {
    font-size: 22px;
    margin: 0 0 6px;
    color: var(--primary);
}

.trial-form-sub {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 20px;
}

.trial-plan-label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
}

.trial-plan-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.trial-plan-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
    text-align: right;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.trial-plan-option:hover {
    border-color: rgba(201, 162, 39, 0.45);
}

.trial-plan-option.active {
    border-color: var(--accent, #c9a227);
    background: rgba(201, 162, 39, 0.08);
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.15);
}

.trial-plan-option-icon {
    font-size: 22px;
    line-height: 1;
}

.trial-plan-option-title {
    font-weight: 800;
    font-size: 14px;
    color: var(--text);
}

.trial-plan-option-desc {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
}

.trial-terms {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin: 12px 0 0;
}

.trial-success {
    background: linear-gradient(135deg, #ecfdf3 0%, #e8f5ee 55%, #f0f9ff 100%);
    color: #1c7c48;
    border: 1px solid #bfe6cf;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(28, 124, 72, 0.12);
}

@media (max-width: 860px) {
    .trial-grid { grid-template-columns: 1fr; gap: 28px; }
    .trial-plan-options { grid-template-columns: 1fr; }
}

.landing-app { background: var(--white); }

.landing-updates-note {
    max-width: 720px;
    margin: 0 auto 20px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 14px;
    text-align: center;
    line-height: 1.7;
}

.app-download-row {
    display: flex;
    justify-content: center;
    margin: 8px 0 10px;
}

.hero-store-badges {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.store-badges-combo {
    position: relative;
    display: inline-block;
    width: min(100%, 340px);
    line-height: 0;
}

.store-badges-combo-img {
    display: block;
    width: 100%;
    height: auto;
}

.store-badges-hit {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
}

.store-badges-hit-android {
    left: 0;
    border-radius: 10px 0 0 10px;
    transition: background 0.2s ease;
}

.store-badges-hit-android:hover {
    background: rgba(255, 255, 255, 0.08);
}

.store-badges-hit-disabled {
    cursor: default;
    pointer-events: none;
}

.store-badges-hit-ios {
    right: 0;
    border-radius: 0 10px 10px 0;
    transition: background 0.2s ease;
}

.store-badges-hit-ios-live:hover {
    background: rgba(255, 255, 255, 0.08);
}

.store-badges-hit-ios:not(.store-badges-hit-ios-live) {
    pointer-events: none;
    opacity: 0.88;
    filter: grayscale(0.2);
}

.store-badge-soon-label {
    position: absolute;
    top: -10px;
    right: 8%;
    background: linear-gradient(135deg, #c9a227, #eab308);
    color: #1a202c;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    white-space: nowrap;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-download-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 28px;
}

.landing-download-btn {
    border: 1px solid rgba(255,255,255,0.35);
}

.landing-students {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.students-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: start;
}

.students-lead {
    font-size: 16px;
    line-height: 1.9;
    color: var(--text-muted);
    margin: 0 0 18px;
}

.students-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
}

.students-benefits li {
    margin: 0 0 10px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.students-plan-card { position: relative; }

.students-plan-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 99px;
    margin-bottom: 10px;
}

.students-plan-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin: 0 0 12px;
}

.landing-feedback-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1500;
    border: none;
    border-radius: 99px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.footer-feedback-link {
    border: none;
    background: none;
    color: #c9a227;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
    padding: 0;
}

@media (max-width: 860px) {
    .students-grid { grid-template-columns: 1fr; }
    .landing-feedback-fab { left: 16px; right: 16px; width: calc(100% - 32px); }
}

.app-showcase {
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 8px;
}

.phone-mockup { text-align: center; flex: 0 1 240px; }
.phone-mockup-featured { transform: translateY(-12px); }
.phone-mockup-featured .phone-frame {
    box-shadow: 0 28px 56px rgba(30, 58, 138, 0.22);
}

.phone-caption {
    margin-top: 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.phone-frame {
    background: #111827;
    border-radius: 28px;
    padding: 10px 8px 12px;
    box-shadow: 0 24px 48px rgba(30, 58, 138, 0.18);
    border: 2px solid #1f2937;
}

.phone-notch {
    width: 72px;
    height: 6px;
    background: #374151;
    border-radius: 99px;
    margin: 0 auto 8px;
}

.phone-screen {
    border-radius: 20px;
    overflow: hidden;
    min-height: 380px;
    text-align: right;
    font-size: 11px;
}

/* لقطات شاشة حقيقية من تطبيق ميزان */
.phone-screen-shot {
    min-height: 0;
    aspect-ratio: 9 / 19.5;
    background: #f8fafc;
    line-height: 0;
}

.phone-screen-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.phone-screen-login {
    background: linear-gradient(160deg, #1e3a8a, #2563eb);
    padding: 24px 14px;
    color: #fff;
}

.mock-login-hero { text-align: center; margin-bottom: 20px; }
.mock-login-hero .mock-logo { font-size: 28px; margin-bottom: 8px; }
.mock-login-hero strong { display: block; font-size: 16px; }
.mock-login-hero span { opacity: 0.85; font-size: 10px; }

.mock-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 12px;
    color: var(--text);
}

.mock-field {
    height: 28px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
}

.mock-btn {
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-top: 6px;
}

.mock-btn.primary { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; }

.phone-screen-dashboard,
.phone-screen-cases {
    background: #f8fafc;
    padding: 12px 10px;
    color: var(--text);
}

.mock-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 12px;
}

.mock-pill {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 9px;
}

.mock-pill.sm { font-size: 8px; }

.mock-welcome {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
    font-size: 10px;
    color: var(--text-secondary);
}

.mock-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.mock-stat {
    background: #fff;
    border-radius: 10px;
    padding: 10px 8px;
    border: 1px solid var(--border-light);
}

.mock-stat b { display: block; font-size: 16px; color: var(--primary); }
.mock-stat small { color: var(--text-muted); font-size: 9px; }

.mock-stages {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.mock-stages span {
    flex: 1;
    min-width: 40px;
    text-align: center;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    border-radius: 8px;
    padding: 6px 4px;
    font-size: 8px;
    font-weight: 600;
}

.mock-search {
    height: 24px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.mock-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.mock-tabs span {
    padding: 4px 8px;
    border-radius: 99px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 8px;
}

.mock-tabs span.on {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    border-color: transparent;
}

.mock-list-item {
    height: 42px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    margin-bottom: 6px;
}

.mock-list-item.short { width: 70%; }

.mock-bottom-nav {
    height: 28px;
    background: #fff;
    border-radius: 10px 10px 0 0;
    border-top: 1px solid var(--border);
    margin: 16px -10px -12px;
}

.landing-pricing { background: var(--bg); }

.pricing-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.pricing-type-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.pricing-type-icon { font-size: 32px; }
.pricing-type-head h3 { margin: 0; font-size: 1.25rem; color: var(--text); }
.pricing-type-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

.pricing-card h4 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.pricing-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.6; }

.about-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 32px;
    align-items: start;
    max-width: 960px;
    margin: 0 auto;
}

.about-copy p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.9;
    margin-bottom: 14px;
}

.about-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.about-badges span {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.about-card h3 { margin-bottom: 8px; color: var(--text-muted); font-size: 13px; font-weight: 600; }

.flexiware-link {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    color: var(--primary);
    font-size: 1.4rem;
}

.flexiware-link span { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.footer a { color: var(--primary); font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* ─── LANDING NAV ANIMATION ─── */
.landing-page { scroll-behavior: smooth; }

.landing-nav {
    transition: padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.35s ease,
        box-shadow 0.35s ease,
        border-color 0.35s ease,
        backdrop-filter 0.35s ease;
}

.landing-nav.is-scrolled {
    padding: 12px 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: transparent;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.1);
}

.landing-nav .logo img {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s ease;
}

.landing-nav.is-scrolled .logo img {
    height: 40px;
}

.landing-nav .nav-links .nav-anchor {
    position: relative;
    display: inline-block;
    padding: 6px 2px;
    transition: color 0.25s ease, transform 0.25s ease;
    animation: navLinkIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-nav .nav-links .nav-anchor:nth-child(1) { animation-delay: 0.05s; }
.landing-nav .nav-links .nav-anchor:nth-child(2) { animation-delay: 0.1s; }
.landing-nav .nav-links .nav-anchor:nth-child(3) { animation-delay: 0.15s; }
.landing-nav .nav-links .nav-anchor:nth-child(4) { animation-delay: 0.2s; }
.landing-nav .nav-links .nav-anchor:nth-child(5) { animation-delay: 0.25s; }

.landing-nav .nav-links .nav-anchor::after {
    content: '';
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    height: 2px;
    border-radius: 99px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing-nav .nav-links .nav-anchor:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

.landing-nav .nav-links .nav-anchor.is-active {
    color: var(--primary);
    font-weight: 700;
}

.landing-nav .nav-links .nav-anchor.is-active::after {
    transform: scaleX(1);
}

.landing-nav .nav-cta {
    animation: navLinkIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.landing-nav .nav-cta:hover {
    transform: translateY(-2px);
}

/* زر القائمة (هامبرغر) — يظهر فقط على الجوال */
.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    z-index: 120;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 99px;
    background: var(--primary);
    transition: transform 0.28s ease, opacity 0.2s ease;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* زر قائمة لوحة التحكم (الجوال) */
.dash-nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.dash-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 99px;
    background: var(--primary);
    transition: transform 0.28s ease, opacity 0.2s ease;
}

.dash-nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.dash-nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.dash-nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* خلفية معتمة خلف قائمة لوحة التحكم على الجوال */
.sidebar-backdrop {
    display: none;
}

.nav-scroll-progress {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    width: 0;
    background: var(--gradient-primary);
    border-radius: 99px 0 0 99px;
    transition: width 0.15s linear;
    pointer-events: none;
}

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

.landing-page .reveal-section {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.landing-page .reveal-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.landing-page .hero.reveal-section {
    transform: translateY(16px);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .main-content { margin-right: 0; padding: 16px; max-width: 100%; }
    .dashboard-layout { flex-direction: column; }
    .top-bar { margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
    .top-bar h1 { font-size: 1.2rem; flex: 1; min-width: 0; }
    .min-card, .mx-card, .neu-card { padding: 16px; }
    .hero h1 { font-size: 1.8rem; }
    .container { padding: 0 20px; }
    .protection-grid, .pricing-types, .about-grid { grid-template-columns: 1fr; }
    .phone-mockup-featured { transform: none; }

    /* ─── لوحة التحكم: قائمة تنسدل من الأعلى (مخفية افتراضياً) ─── */
    .dash-nav-toggle { display: flex; }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 90;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.28s ease, visibility 0.28s;
    }

    .sidebar-backdrop.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 90vh;
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        border-left: none;
        border-bottom: 1px solid var(--border);
        border-radius: 0 0 22px 22px;
        box-shadow: 0 20px 48px rgba(26, 58, 107, 0.22);
        z-index: 100;
        transform: translateY(-105%);
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        overflow-y: auto;
    }

    .sidebar.is-open {
        transform: translateY(0);
    }

    body.dash-menu-open {
        overflow: hidden;
    }

    /* على الجوال: أخفِ الروابط من الشريط وأظهر زر القائمة */
    .nav-toggle { display: flex; }

    .nav-mobile-login {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        min-height: 42px;
    }

    .nav-cta-desktop { display: none !important; }

    .landing-nav .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 16px;
        left: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 18px;
        box-shadow: 0 20px 48px rgba(26, 58, 107, 0.18);
        /* مطويّة افتراضياً — تنسدل من الأعلى عند الفتح */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-14px);
        transform-origin: top center;
        transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s;
    }

    .landing-nav .nav-links.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .landing-nav .nav-links .nav-anchor {
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 15px;
        animation: none;
    }

    .landing-nav .nav-links .nav-anchor:hover,
    .landing-nav .nav-links .nav-anchor.is-active {
        background: var(--primary-light, #e9eef7);
    }

    .landing-nav .nav-links .nav-anchor::after { display: none; }

    .landing-nav .nav-links .nav-cta {
        margin-top: 4px;
        text-align: center;
        animation: none;
    }
}

/* ─── SUBSCRIPTION REQUEST MODAL ─── */
.subscription-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.subscription-modal[hidden] {
    display: none !important;
}

.subscription-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.subscription-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.subscription-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.subscription-modal-plan {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 20px;
}

.subscription-form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.subscription-form-errors p {
    margin: 0 0 6px;
}

.subscription-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f766e;
    color: #fff;
    padding: 14px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 2100;
    transition: opacity 0.4s, transform 0.4s;
}

.subscription-toast.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
}

/* ─── PRICING 3 COLUMNS ─── */
.pricing-types-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .pricing-types-3 { grid-template-columns: 1fr; }
}

.price-custom {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary, #2563eb);
}

/* ─── BANK TRANSFER BOX ─── */
.bank-transfer-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    text-align: right;
}

.bank-transfer-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: #0f172a;
}

.bank-transfer-details {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bank-transfer-details li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 14px;
}

.bank-transfer-details li:last-child { border-bottom: none; }
.bank-transfer-details li span { color: #64748b; }
.bank-transfer-details li strong { color: #0f172a; }

.bank-transfer-note {
    margin: 12px 0 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.7;
}

.field-hint { display: block; margin-top: 6px; font-size: 12px; color: #94a3b8; }
.field-error { margin-top: 6px; font-size: 13px; color: #b91c1c; }

.billing-amount {
    margin-top: 10px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-weight: 700;
    color: #1e40af;
    font-size: 15px;
    text-align: center;
    min-height: 20px;
}
.billing-amount:empty { display: none; }

/* ─── ACTIVITY LOG ─── */
.activity-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
}
.activity-filters .min-input { width: auto; min-width: 160px; margin: 0; }

.activity-table td { vertical-align: top; }
.activity-note { font-size: 14px; color: #0f172a; line-height: 1.6; }

.activity-changes { margin-top: 8px; }
.activity-changes summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--primary, #2563eb);
    user-select: none;
}
.activity-changes ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.activity-changes li { font-size: 13px; padding: 3px 0; line-height: 1.7; }
.chg-label { font-weight: 600; color: #334155; }
.chg-old { color: #b91c1c; text-decoration: line-through; opacity: 0.75; }
.chg-arrow { color: #94a3b8; margin: 0 4px; }
.chg-new { color: #16a34a; font-weight: 600; }

/* ─── SIDEBAR SUBSCRIPTION FOOTER ─── */
.sidebar-subscription {
    margin: 20px 16px 0;
    padding: 14px;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    text-align: right;
}

.sidebar-subscription.is-soon { background: #fffbeb; border-color: #fde68a; }
.sidebar-subscription.is-expired { background: #fef2f2; border-color: #fecaca; }

.sidebar-sub-label { font-size: 12px; color: #64748b; margin-bottom: 4px; }

.sidebar-sub-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.sidebar-sub-status.pending { background: #dbeafe; color: #1d4ed8; }
.sidebar-sub-status.expired { background: #fee2e2; color: #b91c1c; }

.sidebar-sub-date { font-size: 13px; color: #0f172a; margin-bottom: 10px; }
.sidebar-sub-days { color: #64748b; font-size: 12px; }

.sidebar-sub-btn { width: 100%; }
.min-btn-sm { padding: 6px 12px; font-size: 13px; }

/* ─── SUBSCRIPTION RENEWAL PAGE ─── */
.subscription-page {
    min-height: 100vh;
    background: #f5f7fb;
    padding: 24px 16px;
}

.subscription-page-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.subscription-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subscription-logo { height: 44px; }

.subscription-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 12px;
}

.subscription-banner .banner-icon { font-size: 28px; }
.subscription-banner strong { display: block; font-size: 16px; }
.subscription-banner p { margin: 4px 0 0; font-size: 14px; }

.banner-expired { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner-pending { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.banner-active { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

.subscription-renew-form { display: flex; flex-direction: column; gap: 20px; }
.subscription-renew-form h3 { margin: 0 0 14px; font-size: 16px; }

.subscription-plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 560px) { .subscription-plan-grid { grid-template-columns: 1fr; } }

.subscription-plan-option {
    display: block;
    cursor: pointer;
    position: relative;
}
.subscription-plan-option input { position: absolute; opacity: 0; }

.subscription-plan-body {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    transition: border-color 0.2s, background 0.2s;
}
.subscription-plan-option input:checked + .subscription-plan-body {
    border-color: var(--primary, #2563eb);
    background: #eff6ff;
}

.subscription-plan-name { font-weight: 700; margin-bottom: 6px; }
.subscription-plan-price { font-size: 14px; color: #0f172a; margin-bottom: 6px; }
.subscription-plan-specs { font-size: 12px; color: #64748b; line-height: 1.6; }
.subscription-custom-note { margin: 14px 0 0; font-size: 13px; color: #64748b; }
.subscription-logout { text-align: center; }

/* ─── SUBSCRIPTION POPUP ─── */
.sub-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}
.sub-popup.is-open { display: flex; }

.sub-popup-card {
    position: relative;
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: subPopIn 0.3s ease;
}

@keyframes subPopIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sub-popup-icon { font-size: 40px; margin-bottom: 8px; }
.sub-popup-card h3 { margin: 0 0 8px; }
.sub-popup-card p { margin: 0 0 20px; color: #64748b; line-height: 1.7; }

.sub-popup-close {
    position: absolute;
    top: 10px;
    left: 12px;
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
}

.sub-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── CONFETTI ─── */
.mizan-confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3000;
    overflow: hidden;
}

.mizan-confetti-piece {
    position: absolute;
    top: -28px;
    opacity: 0;
    will-change: transform, opacity;
    animation-name: mizanConfettiFall, mizanConfettiSway;
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1), ease-in-out;
    animation-fill-mode: forwards, none;
    animation-iteration-count: 1, infinite;
    animation-direction: normal, alternate;
}

.mizan-confetti-rect {
    width: 9px;
    height: 15px;
    border-radius: 2px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.mizan-confetti-ribbon {
    width: 5px;
    height: 20px;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.mizan-confetti-circle {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
}

.mizan-confetti-triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid var(--confetti-color);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08));
}

.mizan-confetti-streamer {
    width: 14px;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--confetti-color), color-mix(in srgb, var(--confetti-color) 55%, white));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

@keyframes mizanConfettiFall {
    0% {
        transform: translate3d(0, -40px, 0) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    6% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift, 0), 108vh, 0) rotate(var(--spin, 720deg)) scale(1);
        opacity: 0.92;
    }
}

@keyframes mizanConfettiSway {
    0% { margin-left: calc(var(--sway, 24px) * -1); }
    100% { margin-left: var(--sway, 24px); }
}

.trial-success.is-celebrating {
    animation: mizanCelebratePopPlain 0.65s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.subscription-toast.is-celebrating {
    animation: mizanCelebratePopToast 0.65s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes mizanCelebratePopPlain {
    0% { transform: scale(0.94); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes mizanCelebratePopToast {
    0% { transform: translateX(-50%) scale(0.94); opacity: 0.6; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ===== Smart Assistant (Mizan AI) ===== */
.smart-assistant { display: flex; flex-direction: column; gap: 18px; }

.sa-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #1a3a6b 0%, #2b5a9e 100%);
    color: #fff;
}
.sa-title { display: flex; align-items: center; gap: 14px; }
.sa-bot { font-size: 30px; line-height: 1; }
.sa-title h3 { font-size: 17px; font-weight: 800; margin: 0; }
.sa-title p { font-size: 12.5px; opacity: 0.82; margin: 2px 0 0; }

.sa-confidence { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sa-confidence small { font-size: 11px; opacity: 0.85; }
.sa-ring {
    --val: 0;
    width: 58px; height: 58px; border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--accent) calc(var(--val) * 1%), rgba(255,255,255,0.22) 0);
}
.sa-ring span {
    width: 44px; height: 44px; border-radius: 50%;
    background: #1a3a6b; display: grid; place-items: center;
    font-size: 13px; font-weight: 800; color: #fff;
}

.sa-keywords { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sa-kw-label { font-size: 12.5px; color: var(--text-muted); margin-left: 4px; }
.sa-chip {
    font-size: 12px; font-weight: 600; color: var(--primary);
    background: rgba(26,58,107,0.08); border: 1px solid rgba(26,58,107,0.15);
    padding: 3px 10px; border-radius: 999px;
}

.sa-answer-wrap {
    padding: 14px 16px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border);
    border-right: 4px solid var(--primary);
}
.sa-answer { font-size: 14px; line-height: 1.75; color: var(--text); margin: 0; }
.sa-llm-badge {
    margin: 10px 0 0; font-size: 12px; font-weight: 700; color: #6d28d9;
}

.sa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .sa-grid { grid-template-columns: 1fr; } }

.sa-col h4 {
    font-size: 14px; font-weight: 800; color: var(--text); margin: 0 0 10px;
    display: flex; align-items: center; gap: 8px;
}
.sa-count {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
    min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
}

.sa-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); transition: var(--transition); text-decoration: none;
}
.sa-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sa-item-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sa-item-title { font-size: 13.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sa-item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.sa-excerpt { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

.sa-tag { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; color: #fff; }
.sa-tag-precedent { background: #7c3aed; }
.sa-tag-law { background: #0e7490; }
.sa-tag-book { background: #b45309; }
.sa-tag-gazette { background: #15803d; }

.sa-sim {
    flex-shrink: 0; font-size: 13px; font-weight: 800; color: #fff;
    min-width: 46px; text-align: center; padding: 6px 8px; border-radius: var(--radius);
}
.sim-high { background: #16a34a; }
.sim-mid { background: #d97706; }
.sim-low { background: #94a3b8; }

.sa-empty { font-size: 13px; color: var(--text-muted); padding: 16px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.sa-foot { font-size: 11.5px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.sa-item-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sa-item-wrap .sa-item { margin-bottom: 0; }
.sa-context-btn {
    align-self: flex-start;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light, #eef2ff);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
}
.sa-context-btn:hover { background: var(--primary); color: #fff; }
.sa-context-link { text-decoration: none; display: inline-block; }
.mizan-ai-case-ctx {
    font-size: 12.5px;
    color: var(--text-secondary);
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
}
.mizan-ai-shared-kw { margin-bottom: 8px; }
.sa-chip-shared { background: #fef3c7; color: #92400e; }
.mizan-ai-llm-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    color: #6d28d9;
    background: #f3e8ff;
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    padding: 5px 10px;
    margin: 8px 0 4px;
}
.mizan-ai-match-pdf { font-size: 10.5px; font-weight: 700; color: #b45309; background: #fff7ed; padding: 2px 7px; border-radius: 6px; }
.mizan-ai-match-semantic { font-size: 10.5px; font-weight: 700; color: #6d28d9; background: #f3e8ff; padding: 2px 7px; border-radius: 6px; }
.mizan-ai-match-hybrid { font-size: 10.5px; font-weight: 700; color: #0e7490; background: #ecfeff; padding: 2px 7px; border-radius: 6px; }
.mizan-ai-match-article { font-size: 10.5px; font-weight: 700; color: #166534; background: #ecfdf5; padding: 2px 7px; border-radius: 6px; }

/* مقارنة السوابق */
.pc-picker-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.pc-picker-form select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; background: #fff; }
.pc-picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 768px) { .pc-picker-grid { grid-template-columns: 1fr; } }
.pc-summary-scores { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pc-score { text-align: center; min-width: 88px; }
.pc-score-val { display: block; font-size: 22px; font-weight: 800; color: var(--primary); }
.pc-score small { font-size: 11px; color: var(--text-muted); }
.pc-head-titles { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pc-head-link { font-weight: 700; color: var(--primary); text-decoration: none; }
.pc-vs { color: var(--text-muted); font-weight: 800; }
.pc-list-card h4 { margin-bottom: 10px; font-size: 14px; }
.pc-list-card ul { margin: 0; padding-right: 18px; line-height: 1.8; font-size: 13px; }
.pc-similar { border-right: 4px solid #16a34a; }
.pc-different { border-right: 4px solid #dc2626; }
.pc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pc-table th, .pc-table td { border: 1px solid var(--border); padding: 10px 12px; vertical-align: top; text-align: right; }
.pc-table thead th { background: var(--bg-muted, #f8fafc); font-weight: 800; }
.pc-table tbody th { width: 120px; background: #fafafa; font-weight: 700; white-space: nowrap; }
.pc-table tr.pc-same td { background: #f0fdf4; }
.pc-table tr.pc-diff td { background: #fef2f2; }
.pc-table tr.pc-partial td { background: #fffbeb; }
.pc-status { font-size: 11px; font-weight: 700; }
.sa-tag-case { background: #1a3a6b; }

/* ===== Mizan AI floating chat ===== */
.mizan-ai { position: fixed; bottom: 24px; left: 24px; z-index: 1200; }

.mizan-ai-fab {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px; border: none; cursor: pointer;
    border-radius: 999px; color: #fff; font-family: inherit; font-weight: 700; font-size: 14px;
    background: linear-gradient(135deg, #1a3a6b 0%, #2b5a9e 100%);
    box-shadow: 0 6px 20px rgba(26,58,107,0.35);
    transition: transform var(--transition), box-shadow var(--transition);
}
.mizan-ai-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(26,58,107,0.45); }
.mizan-ai-fab-icon { font-size: 20px; line-height: 1; display: inline-grid; place-items: center; width: 22px; height: 22px; }
/* عند الفتح: تتحوّل الأيقونة إلى زر إغلاق دائري */
.mizan-ai.open .mizan-ai-fab { padding: 0; width: 52px; height: 52px; justify-content: center; }
.mizan-ai.open .mizan-ai-fab-text { display: none; }
.mizan-ai.open .mizan-ai-fab-icon { font-size: 22px; }

.mizan-ai-panel {
    position: fixed; bottom: 90px; left: 24px;
    width: 380px; max-width: calc(100vw - 32px);
    height: 560px; max-height: calc(100vh - 120px);
    display: none; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
}
.mizan-ai.open .mizan-ai-panel { display: flex; animation: mizanAiIn 0.18s ease; }
@keyframes mizanAiIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.mizan-ai-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; color: #fff;
    background: linear-gradient(135deg, #1a3a6b 0%, #2b5a9e 100%);
}
.mizan-ai-head-title { display: flex; align-items: center; gap: 10px; }
.mizan-ai-avatar { font-size: 24px; }
.mizan-ai-head-title strong { display: block; font-size: 15px; }
.mizan-ai-head-title small { font-size: 11.5px; opacity: 0.82; }
.mizan-ai-close {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1;
}
.mizan-ai-close:hover { background: rgba(255,255,255,0.28); }

.mizan-ai-body {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px; background: var(--bg);
}

.mizan-ai-msg { display: flex; }
.mizan-ai-msg.user { justify-content: flex-start; }
.mizan-ai-msg.bot { justify-content: flex-start; }
.mizan-ai-bubble {
    max-width: 88%; padding: 10px 13px; border-radius: 14px;
    font-size: 13.5px; line-height: 1.7; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
}
.mizan-ai-msg.user .mizan-ai-bubble {
    background: #1a3a6b; color: #fff; border-color: #1a3a6b; margin-inline-start: auto; max-width: 90%;
}

.mizan-ai-answer { font-size: 13.5px; line-height: 1.75; color: var(--text); }
.mizan-ai-meta-line { margin-top: 6px; }
.mizan-ai-conf { font-size: 11px; font-weight: 700; color: var(--accent); }
.mizan-ai-kw { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mizan-ai-section-label { font-size: 12px; font-weight: 800; color: var(--text-secondary); margin: 10px 0 6px; }

.mizan-ai-card {
    display: block; text-decoration: none; padding: 10px 11px; margin-bottom: 8px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    transition: var(--transition);
}
.mizan-ai-card:hover { border-color: var(--primary); background: #fff; }
.mizan-ai-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mizan-ai-card-title { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--text); }
.mizan-ai-card-excerpt { font-size: 11.5px; color: var(--text-secondary); line-height: 1.6; margin: 6px 0 0; }
.mizan-ai-card-excerpt .ai-text-highlight,
.ai-text-highlight {
    background: rgba(255, 235, 59, 0.45);
    padding: 1px 2px;
    border-radius: 3px;
}
.mizan-ai-card-cat { display: inline-block; font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.mizan-ai-card-link { display: block; font-size: 11.5px; font-weight: 700; color: var(--primary); margin-top: 6px; }

.mizan-ai-suggestions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; width: 100%; }
.mizan-ai-sugg {
    font-family: inherit; font-size: 12.5px; color: var(--primary); cursor: pointer;
    background: rgba(26,58,107,0.06); border: 1px solid rgba(26,58,107,0.16);
    padding: 8px 12px; border-radius: 12px; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px; width: 100%; text-align: right;
}
.mizan-ai-sugg-label { flex: 1; }
.mizan-ai-sugg-score {
    font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
    background: rgba(34, 197, 94, 0.15); color: #15803d; white-space: nowrap;
}
.mizan-ai-sugg:hover { background: rgba(26,58,107,0.12); }

.mizan-ai-input {
    display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface);
}
.mizan-ai-input textarea {
    flex: 1; resize: none; font-family: inherit; font-size: 13.5px; line-height: 1.5;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px;
    max-height: 120px; color: var(--text); background: var(--bg);
}
.mizan-ai-input textarea:focus { outline: none; border-color: var(--primary); }
.mizan-ai-send {
    flex-shrink: 0; width: 40px; height: 40px; border: none; cursor: pointer;
    border-radius: 50%; color: #fff; font-size: 16px;
    background: linear-gradient(135deg, #1a3a6b 0%, #2b5a9e 100%);
    transform: scaleX(-1);
}
.mizan-ai-send:hover { opacity: 0.92; }

.mizan-ai-typing { display: flex; gap: 4px; align-items: center; }
.mizan-ai-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted);
    animation: mizanAiBlink 1.2s infinite ease-in-out both;
}
.mizan-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.mizan-ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mizanAiBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

@media (max-width: 480px) {
    .mizan-ai { left: 12px; bottom: 12px; }
    .mizan-ai-panel { left: 12px; bottom: 12px; width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: calc(100vh - 24px); }
    .mizan-ai.open .mizan-ai-fab { display: none; }
}
