/* ════════════════════════════════════════════════════════════════
   app.css — Global application styles
   Project: Ebtkr Internal System
════════════════════════════════════════════════════════════════ */

/* ── DINNextArabic Font ────────────────────────────────────────── */
@font-face {
    font-family: "DINNextArabic";
    src: url("../fonts/DINNextArabic-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "DINNextArabic";
    src: url("../fonts/DINNextLTArabic-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "DINNextArabic";
    src: url("../fonts/DINNextLTArabic-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --bg-start: #f7fbff;
    --bg-end: #eef4fa;
    --surface: #ffffff;
    --surface-soft: #f9fbfd;
    --text: #10233a;
    --muted: #5d6f85;
    --line: #dbe6f0;
    --primary: #0f4c81;
    --primary-strong: #08345a;
    --primary-tint: #eff6ff;
    --accent: #0ea5a4;
    --danger: #c0262d;
    --shadow-lg: 0 16px 35px rgba(9, 38, 66, 0.11);
    --shadow-sm: 0 8px 20px rgba(10, 40, 70, 0.07);
    --radius: 16px;
    --sidebar-width: 300px;
    --transition: 180ms ease;
}

/* ── Reset & Base ──────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "DINNextArabic", "Tajawal", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at 12% 12%, rgba(14, 165, 164, 0.08), transparent 46%),
        radial-gradient(circle at 82% 18%, rgba(15, 76, 129, 0.12), transparent 44%),
        linear-gradient(160deg, var(--bg-start), var(--bg-end));
    color: var(--text);
    line-height: 1.6;
}

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

/* ── Layout ────────────────────────────────────────────────────── */
.container {
    width: min(1320px, 96%);
    margin: 0 auto;
    padding: 1.25rem 0 2rem;
}

.guest-layout .container {
    width: min(1180px, 96%);
    margin: 0 auto;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(2px);
    animation: fade-up .28s ease both;
}

/* ── Flash Messages ────────────────────────────────────────────── */
.flash-success, .flash-error {
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    font-weight: 700;
}

.flash-success {
    border: 1px solid #3ac3a1;
    background: #d8f8ee;
    color: #0b6b54;
}

.flash-error {
    border: 1px solid #f3848a;
    background: #ffe4e5;
    color: #8f1f27;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    font-family: "DINNextArabic", "Tajawal", "Segoe UI", Tahoma, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border: 0;
    border-radius: 10px;
    padding: .46rem .82rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
    box-shadow: 0 10px 16px rgba(6, 45, 87, .22);
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.btn-danger {
    background: linear-gradient(135deg, #d13f45, var(--danger));
    box-shadow: 0 10px 16px rgba(141, 26, 32, .22);
}

.btn-action {
    min-width: 62px;
    justify-content: center;
    padding: .34rem .62rem;
    border-radius: 8px;
    box-shadow: none;
    font-size: .82rem;
    line-height: 1.25;
    margin-inline-end: .35rem;
}

.btn-view   { background: linear-gradient(135deg, #2578c9, #14579a); color: #fff; }
.btn-edit   { background: linear-gradient(135deg, #7f8c9b, #5f6f80); color: #fff; }
.btn-delete { background: linear-gradient(135deg, #dc4b52, #b8252f); color: #fff; }
.btn-print  { background: linear-gradient(135deg, #2a9ea0, #17777b); color: #fff; }

/* ── Forms ─────────────────────────────────────────────────────── */
.input, select, textarea {
    width: 100%;
    border: 1px solid #cfdae6;
    border-radius: 12px;
    padding: .64rem .74rem;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
        font-family: 'DINNextArabic';
}

.input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: #5ca7de;
    box-shadow: 0 0 0 4px rgba(50, 128, 199, .12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: .9rem;
}

label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 800;
}

/* ── Tables ────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    overflow: hidden;
}

th, td {
    border-bottom: 1px solid #e5edf5;
    padding: .7rem .65rem;
    text-align: right;
    vertical-align: top;
}

th {
    background: #f6fbff;
    color: #1a3552;
    font-size: .9rem;
}


.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .42rem;
}

.actions > form { margin: 0; display: inline-flex; }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 12px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 18px;
    background: linear-gradient(130deg, rgba(9, 49, 86, .95), rgba(13, 82, 126, .95));
    color: #f3f8ff;
    border: 1px solid rgba(190, 221, 246, .26);
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
}

/* ── Brand ─────────────────────────────────────────────────────── */
.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    flex: 1;
}

.brand-badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1cc7b8, #43a6ff);
    color: #062747;
    font-weight: 900;
    font-size: .93rem;
    box-shadow: 0 10px 16px rgba(0, 0, 0, .25);
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
}

.brand h1 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand small {
    display: block;
    color: #c7def3;
    font-size: .8rem;
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Topbar Tools ──────────────────────────────────────────────── */
.topbar-tools {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.top-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(206, 230, 255, 0.4);
    background: rgba(211, 232, 255, 0.14);
    color: #eaf4ff;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

.top-icon-btn:hover {
    background: rgba(211, 232, 255, 0.26);
    transform: translateY(-1px);
}

.top-icon-btn[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.55);
}

.top-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #d9ecff;
    background: rgba(223, 238, 255, 0.12);
    border: 1px solid rgba(203, 228, 255, 0.25);
    border-radius: 999px;
    padding: .36rem .7rem;
    font-size: .85rem;
    transition: all var(--transition);
}

.top-pill:hover {
    background: rgba(223, 238, 255, 0.2);
    color: #fff;
    transform: translateY(-1px);
}

/* ── User Menu ─────────────────────────────────────────────────── */
.user-menu { position: relative; }

.user-menu-toggle {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.user-menu.open .user-menu-toggle {
    background: rgba(223, 238, 255, 0.26);
    color: #fff;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #d5e2f0;
    border-radius: 12px;
    box-shadow: 0 16px 28px rgba(13, 42, 72, 0.2);
    padding: .35rem;
    z-index: 90;
    animation: fade-up .16s ease both;
}

.user-menu-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: #1d4268;
    border-radius: 10px;
    text-align: right;
    padding: .55rem .62rem;
    cursor: pointer;
    font-family: inherit;
    font-size: .92rem;
    transition: background var(--transition), color var(--transition);
}

.user-menu-item:hover      { background: #e9f4ff; color: #0c3f6b; }
.user-menu-item-danger     { color: #b32533; }
.user-menu-item-danger:hover { background: #ffe8ea; color: #9f1d2a; }
.user-menu-form            { margin: 0; }
.topbar-guest .topbar-tools { gap: .85rem; }

/* ── Icons ─────────────────────────────────────────────────────── */
.icon    { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.icon-lg { width: 18px; height: 18px; }

/* ── Sidebar toggle (mobile hamburger) ─────────────────────────── */
.sidebar-toggle {
    display: none;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #0e6bb0, #094978);
    color: #fff;
    width: 42px;
    height: 42px;
    cursor: pointer;
    box-shadow: 0 10px 16px rgba(5, 48, 82, .28);
}

/* ── Theme Toggle ──────────────────────────────────────────────── */
.theme-toggle {
    width: 74px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(206, 230, 255, 0.4);
    background: linear-gradient(145deg, #a4d6ff, #57a8ff);
    cursor: pointer;
    padding: 3px;
    position: relative;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover { transform: translateY(-1px); }

.theme-toggle .theme-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fffbe9;
    box-shadow: 0 6px 12px rgba(0, 0, 0, .22);
    position: absolute;
    top: 3px;
    right: 3px;
    transition: transform 240ms cubic-bezier(.2,.8,.2,1), background var(--transition);
    display: grid;
    place-items: center;
    color: #c07809;
}

.theme-toggle .moon,
.theme-toggle .sun {
    position: absolute;
    width: 16px;
    height: 16px;
    top: 11px;
    transition: opacity var(--transition), transform var(--transition);
    color: #f0f8ff;
}

.theme-toggle .sun { left: 10px; opacity: 1; transform: scale(1); }
.theme-toggle .moon { right: 10px; opacity: .5; transform: scale(.78); }

/* ── Misc ──────────────────────────────────────────────────────── */
.footer-card   { text-align: center; color: var(--muted); font-weight: 600; }
footer.container { padding-top: 0; }
img.brand-badge  { object-fit: cover; }
.muted           { color: var(--muted); }

/* ── Settings / Form Utilities ─────────────────────────────────── */
.card > h1               { margin-top: 0; }
.card > h2:first-child  { margin-top: 0; }
.page-subtitle          { margin-top: -.35rem; }
.form-section-title     { margin: .1rem 0 .85rem; }
.form-actions           { margin-top: 1rem; display: flex; gap: .45rem; }
.col-full               { grid-column: 1 / -1; }
.mb-0                   { margin-bottom: 0; }
.mb-field               { margin-bottom: .8rem; }
.mb-lg                  { margin-bottom: 1.5rem; }
.mt-lg                  { margin-top: 1.5rem; }
.label-top-offset       { margin-top: 1.9rem; }
.text-truncate          { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-card              { width: 100%; max-width: 460px; }
.auth-title             { font-size: 1.35rem; }
.login-card             { max-width: 520px; margin: 1rem auto; }
.narrow-card            { max-width: 560px; }
.medium-card            { max-width: 700px; }
.input--icon-left       { padding-left: 2.4rem; }
.info-box               { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .85rem; margin-bottom: 1rem; font-size: .85rem; color: var(--muted); }
.text-success           { color: #059669; font-weight: 700; }
.form-inline            { display: inline; }
.settings-logo-thumb {
    width: 72px; height: 72px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid #d8e4f0;
    display: block;
}
.settings-favicon-thumb {
    width: 48px; height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #d8e4f0;
    display: block;
}
.details-box { border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; }
.details-box > summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--primary); }
.details-box > form, .details-form { margin-top: .85rem; }
.input[readonly]  { background: var(--surface-soft); color: var(--muted); cursor: not-allowed; }

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.page-header h1 { margin: 0; }

/* ── Search / Filter Bar ───────────────────────────────────────── */
.search-bar {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .75rem 1rem;
    margin: .75rem 0 .85rem;
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: flex-end;
}
.search-bar label {
    font-size: .74rem;
    color: var(--muted);
    display: block;
    margin-bottom: .2rem;
    font-weight: 600;
}
.search-bar .input,
.search-bar select,
.search-bar input[type="text"],
.search-bar input[type="date"],
.search-bar input[type="search"] {
    padding: .38rem .65rem;
    border-radius: 7px;
    font-size: .85rem;
    width: 100%;
}
.search-bar button[data-clear] {
    padding: .4rem .85rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem;
    color: var(--muted);
}

/* ── Stats / KPI Cards Grid ────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .6rem;
    margin-bottom: .9rem;
}
.stat-card {
    padding: .7rem .9rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: center;
    margin: 0;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
}
.stat-value--lg { font-size: 1.6rem; }
.stat-value--md { font-size: 1.2rem; }
.stat-label {
    font-size: .77rem;
    color: var(--muted);
    margin-top: .15rem;
}
.stat-card--success { background: #d4f5e9; border-color: #a7f3d0; }
.stat-card--success .stat-value,
.stat-card--success .stat-label { color: #1a7a5e; }
.stat-card--danger  { background: #fee2e2; border-color: #fca5a5; }
.stat-card--danger  .stat-value,
.stat-card--danger  .stat-label { color: #b52533; }
.stat-card--warning { background: #fff3cd; border-color: #fde68a; }
.stat-card--warning .stat-value { color: #d97706; }
.stat-card--accent  { background: #e0f2fe; border-color: #bae6fd; }
.stat-card--accent  .stat-value { color: var(--accent); }

/* ── Delete Confirm Modal ──────────────────────────────────────── */
.del-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease;
}
.del-modal:target {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.del-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
}
.del-box {
    position: relative;
    width: min(460px, 96vw);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(2, 6, 23, .35);
    padding: 1.1rem 1.1rem 1rem;
    transform: translateY(8px) scale(.98);
    transition: transform .2s ease;
}
.del-modal:target .del-box { transform: translateY(0) scale(1); }
.del-title  { margin: 0 0 .5rem; font-size: 1.03rem; }
.del-text   { margin: 0; color: #475569; font-size: .92rem; line-height: 1.65; }
.del-name   { margin: .65rem 0 0; color: #0f172a; font-size: .9rem; }
.del-actions { margin-top: .95rem; display: flex; gap: .55rem; }
.del-actions .btn { flex: 1; justify-content: center; }

/* ── Status Badges ─────────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
}
.status-paid,
.status-confirmed     { background: #d4f5e9; color: #1a7a5e; }
.status-partially_paid,
.status-pending       { background: #fff3cd; color: #856404; }
.status-draft         { background: #e8edf3; color: #4a5f78; }
.status-sent          { background: #dbeafe; color: #1e40af; }
.status-overdue,
.status-rejected      { background: #fee2e2; color: #b52533; }
.status-cancelled     { background: #f1f5f9; color: #64748b; }

/* ── Animation ─────────────────────────────────────────────────── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ics-fade-in  { from { opacity:0; }                          to { opacity:1; } }
@keyframes ics-slide-up { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ════════════════════════════════════════════════════════════════
   Dark Mode — App-level
════════════════════════════════════════════════════════════════ */
body.theme-dark {
    background:
        radial-gradient(circle at 12% 12%, rgba(28, 120, 174, 0.12), transparent 52%),
        radial-gradient(circle at 82% 18%, rgba(38, 87, 155, 0.16), transparent 50%),
        linear-gradient(160deg, #0b1422, #0f1b2e);
    color: #e8effa;
}

body.theme-dark .card {
    background: rgba(18, 30, 46, 0.95);
    border-color: #30445e;
    color: #e8effa;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .34);
}

body.theme-dark .topbar {
    background: linear-gradient(130deg, rgba(7, 20, 36, .96), rgba(16, 35, 62, .96));
    border-color: rgba(116, 156, 214, .35);
}

body.theme-dark .top-pill {
    color: #d8e6fb;
    background: rgba(146, 181, 228, .14);
    border-color: rgba(148, 186, 238, .3);
}

body.theme-dark .top-pill:hover {
    background: rgba(146, 181, 228, .23);
    color: #eff6ff;
}

body.theme-dark .user-menu-panel {
    background: #142336;
    border-color: #2f4663;
    box-shadow: 0 16px 28px rgba(0, 0, 0, .45);
}

body.theme-dark .user-menu-item          { color: #d2e5ff; }
body.theme-dark .user-menu-item:hover    { background: rgba(140, 181, 235, .2); color: #edf5ff; }
body.theme-dark .user-menu-item-danger   { color: #ffb8bf; }

body.theme-dark .notif-panel             { background: #142336; border-color: #2f4663; box-shadow: 0 16px 28px rgba(0,0,0,.45); }
body.theme-dark .notif-panel-head        { border-color: #2f4663; }
body.theme-dark .notif-drop-item         { border-color: #2f4663; }
body.theme-dark .notif-drop-item--unread { background: rgba(15,76,129,.25); }
body.theme-dark .notif-drop-link:hover   { background: rgba(140,181,235,.12); }
body.theme-dark .notif-drop-title        { color: #d2e5ff; }
body.theme-dark .notif-view-all          { border-color: #2f4663; color: #7bb3f0; }
body.theme-dark .notif-view-all:hover    { background: rgba(140,181,235,.1); }
body.theme-dark .notif-item--unread      { background: rgba(15,76,129,.2); }
body.theme-dark .user-menu-item-danger:hover { background: rgba(191, 53, 67, .25); color: #ffd8dd; }

body.theme-dark table   { background: #131f31; color: #e8effa; }
body.theme-dark th      { background: #1c2d44; color: #d9e8ff; }
body.theme-dark td      { border-bottom-color: #2d4058; }

body.theme-dark .input,
body.theme-dark select,
body.theme-dark textarea {
    background: #0f1b2b;
    border-color: #3a516d;
    color: #edf4ff;
}

body.theme-dark .input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus {
    border-color: #7ba8db;
    box-shadow: 0 0 0 4px rgba(68, 124, 193, .22);
}

body.theme-dark .flash-success {
    background: #0f3d37;
    color: #c9fff2;
    border-color: #1f8b7c;
}

body.theme-dark .flash-error {
    background: #4a1d26;
    color: #ffd9df;
    border-color: #b95f6d;
}

body.theme-dark .theme-toggle {
    background: linear-gradient(145deg, #27395e, #0d1730);
    border-color: rgba(147, 176, 224, 0.5);
}

body.theme-dark .theme-toggle .theme-thumb {
    transform: translateX(-34px);
    background: #dce7ff;
    color: #1f2d4d;
}

body.theme-dark .theme-toggle .moon { opacity: 1; transform: scale(1); color: #e2edff; }
body.theme-dark .theme-toggle .sun  { opacity: .45; transform: scale(.8); }

/* ════════════════════════════════════════════════════════════════
   Responsive — Tablet / Mobile (≤ 1100px)
════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .auth-layout .container {
        margin-right: 0;
        padding: .9rem .85rem 1.4rem;
    }

    /* Show mobile hamburger */
    .sidebar-toggle {
        display: inline-grid;
        place-items: center;
    }

    /* Hide desktop sidebar collapse toggle */
    [data-sidebar-collapse-toggle] { display: none; }

    /* Hide shortcut nav pills — accessible via sidebar */
    .topbar-tools > a.top-pill { display: none; }

    .topbar-tools { flex-wrap: nowrap; }
}

/* ════════════════════════════════════════════════════════════════
   Responsive — Small phones (≤ 540px)
════════════════════════════════════════════════════════════════ */
@media (max-width: 540px) {
    .topbar {
        top: 6px;
        border-radius: 14px;
        padding: .7rem .8rem;
    }

    .brand small   { display: none; }
    .brand h1      { font-size: .88rem; }

    .brand-badge {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: .8rem;
    }

    /* Keep user icon, hide name + chevron */
    .user-name    { display: none; }
    .user-chevron { display: none; }

    .topbar-tools { gap: .35rem; }
}

/* ── User Roles Picker ─────────────────────────────────────────── */
.urole-box {
    border: 1px solid var(--line, #dbe6f0);
    border-radius: 12px;
    padding: .85rem;
    background: linear-gradient(135deg, rgba(15, 76, 129, .05), rgba(14, 165, 164, .08));
}
.urole-head {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .7rem;
}
.urole-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}
.urole-actions .btn { box-shadow: none; }
.urole-counter { color: var(--muted, #5d6f85); font-weight: 700; white-space: nowrap; }
.urole-counter strong { color: var(--primary, #0f4c81); }
.urole-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: .5rem;
}
.urole-item {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    padding: .5rem .6rem;
    border: 1px solid var(--line, #dbe6f0);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    font-weight: 600;
}
.urole-item input[type="checkbox"] { margin: 0; }
@media (max-width: 680px) {
    .urole-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .urole-counter { width: 100%; }
}
@media (max-width: 480px) {
    .urole-grid { grid-template-columns: 1fr; }
}

/* ── Permissions Editor ────────────────────────────────────────── */
.rperm-toolbar {
    display: grid;
    gap: .75rem;
    padding: .8rem;
    border: 1px solid var(--line, #dbe6f0);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 76, 129, .06), rgba(14, 165, 164, .08));
    margin-top: 1rem;
}
.rperm-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}
.rperm-toolbar-row .btn { box-shadow: none; }
.rperm-toolbar-stats { margin-inline-start: auto; color: var(--muted, #5d6f85); font-weight: 700; white-space: nowrap; }
.rperm-toolbar-stats strong { color: var(--primary, #0f4c81); }
.rperm-group { margin-top: .9rem; padding: .85rem; }
.rperm-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .7rem;
}
.rperm-group-title { margin: 0; font-size: 1rem; }
.rperm-group-meta { color: var(--muted, #5d6f85); font-size: .86rem; font-weight: 700; }
.rperm-group-actions,
.rperm-module-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.rperm-group-actions .btn,
.rperm-module-actions .btn { box-shadow: none; }
.rperm-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: .6rem;
}
.rperm-module {
    margin: 0;
    padding: .7rem;
    border: 1px solid var(--line, #dbe6f0);
    border-radius: 12px;
    background: rgba(255, 255, 255, .92);
}
.rperm-module.is-complete { border-color: rgba(14, 165, 164, .45); background: rgba(20, 184, 166, .08); }
.rperm-module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .45rem;
    margin-bottom: .55rem;
    flex-wrap: wrap;
}
.rperm-module-title { margin: 0; font-size: .94rem; }
.rperm-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
}
.rperm-item { display: flex; align-items: center; gap: .35rem; margin: 0; font-weight: 600; padding: .15rem 0; }
.rperm-item--disabled { opacity: .35; cursor: not-allowed; }
.rperm-item--disabled input { pointer-events: none; }
.rperm-module-foot { margin-top: .45rem; color: var(--muted, #5d6f85); font-size: .82rem; font-weight: 700; }
@media (max-width: 680px) {
    .rperm-list { grid-template-columns: 1fr; }
    .rperm-toolbar-stats { margin-inline-start: 0; width: 100%; }
}

/* ════════════════════════════════════════════════════════════════
   Show-page & Detail-view Utilities
════════════════════════════════════════════════════════════════ */

/* ── Inner flex wrappers used inside .page-header ──────────────── */
.title-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.btn-bar   { display: flex; gap: .45rem; flex-wrap: wrap; }

/* ── Button size variants ──────────────────────────────────────── */
.btn-xs  { font-size: .83rem; padding: .35rem .75rem; }
.btn-xxs { font-size: .78rem; padding: .25rem .6rem; }
.btn-back { background: linear-gradient(135deg, var(--muted), #4a5f78); }

/* ── Two-column detail grid ────────────────────────────────────── */
.info-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: .75rem;
}
@media (max-width: 680px) { .info-grid-2 { grid-template-columns: 1fr; } }

/* ── Card sub-section title ─────────────────────────────────────── */
.card-section-title { margin: 0 0 .65rem; font-size: .9rem; color: var(--primary); }

/* ── Sub-section bar (title + action button) ───────────────────── */
.section-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .75rem;
}
.section-bar h3, .section-bar h4 { margin: 0; }

/* ── Form label small ──────────────────────────────────────────── */
.form-label-sm { font-size: .78rem; color: var(--muted); display: block; margin-bottom: .2rem; }

/* ── Overflow X scroll wrapper ─────────────────────────────────── */
.overflow-x { overflow-x: auto; }

/* ── Input size small ──────────────────────────────────────────── */
.input-sm { font-size: .88rem; }

/* ── Info table (show-page key-value pairs) ─────────────────────── */
.info-table { font-size: .88rem; width: 100%; border-collapse: collapse; background: transparent; }
.info-table td { border: none; padding: .3rem 0; vertical-align: top; }
.info-table .inf-lbl { padding-inline-end: .5rem; color: var(--muted); white-space: nowrap; }
.info-table .inf-val { font-weight: 700; }

/* ── Progress bar ──────────────────────────────────────────────── */
.progress-meta  { display: flex; justify-content: space-between; align-items: center; margin-bottom: .45rem; font-size: .8rem; color: var(--muted); }
.progress-track { background: #e2e8f0; border-radius: 99px; height: 9px; overflow: hidden; }
.progress-bar   { height: 100%; border-radius: 99px; transition: width .5s ease; }
.progress-bar--green { background: #10b981; }
.progress-bar--amber { background: #f59e0b; }
.progress-bar--blue  { background: #3b82f6; }
.progress-sub   { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* ── Invoice totals summary ─────────────────────────────────────── */
.totals-wrap { display: flex; justify-content: flex-end; margin-top: .75rem; }
.totals-box  { min-width: 260px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.totals-row  { display: flex; justify-content: space-between; padding: .25rem 0; font-size: .88rem; border-bottom: 1px solid var(--line); }
.totals-row__label { color: var(--muted); }
.totals-total { display: flex; justify-content: space-between; padding: .4rem 0; font-size: 1.1rem; font-weight: 900; color: var(--primary); }

/* ── Meta cards grid (info pills in show pages) ─────────────────── */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.meta-card { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; padding: .85rem 1rem; }
.meta-card__label {
    font-size: .7rem; color: var(--muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem;
}
.meta-card__value { font-weight: 700; font-size: .95rem; }
.meta-card__sub   { font-size: .73rem; color: var(--muted); margin-top: .15rem; }

/* ── Item row lists (tasks, subs in show pages) ─────────────────── */
.item-rows { display: flex; flex-direction: column; gap: .4rem; }
.item-row  { display: flex; align-items: center; gap: .65rem; padding: .55rem .85rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.item-row__info { flex: 1; min-width: 0; }

/* ── File list (project files section) ─────────────────────────── */
.file-list  { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.file-item  { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 1rem; border-top: 1px solid var(--line); }
.file-item:first-child { border-top: none; }
.file-badge { width: 42px; height: 42px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .65rem; font-weight: 800; color: #4a5f78; text-align: center; line-height: 1.2; }
.file-info    { flex: 1; min-width: 0; }
.file-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* ── Status banners (paid/cancelled messages) ───────────────────── */
.banner-success { padding: .7rem 1rem; background: #d4f5e9; border-radius: 8px; color: #1a7a5e; font-weight: 700; font-size: .9rem; text-align: center; }
.banner-neutral { padding: .7rem 1rem; background: #f1f5f9; border-radius: 8px; color: #64748b; font-size: .88rem; text-align: center; }

/* ── Overpay / validation warnings ─────────────────────────────── */
.overpay-warn { display: none; padding: .4rem .75rem; background: #fee2e2; color: #b52533; border-radius: 8px; font-size: .83rem; font-weight: 700; margin-bottom: .5rem; }

/* ── JS-toggled modal overlay ───────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 999; align-items: center; justify-content: center; }
.modal-box     { background: #fff; border-radius: 16px; padding: 2rem; max-width: 380px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }

/* ── Card form section title (create / edit pages) ─────────────── */
.card-form-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Radio / checkbox labels ────────────────────────────────────── */
.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.radio-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 600; }

/* ── Service Picker ─────────────────────────────────────────────── */
.svc-picker { position: relative; }

/* الـ trigger يشتغل كـ input يعرض الـ tags جواه */
.svc-trigger {
    width: 100%;
    min-height: 44px;
    max-height: 80px;        /* سقف الارتفاع = سطرين تقريباً */
    display: flex;
    align-items: flex-start; /* tags تبدأ من الأعلى مش المنتصف */
    gap: .4rem;
    padding: .38rem .65rem .38rem .55rem;
    border: 1.5px solid #cfdae6;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    overflow: hidden;        /* أي زيادة تتقطع مش تكبّر الصفحة */
    transition: border-color .12s, box-shadow .12s;
}
.svc-trigger:hover             { border-color: #6ca3d4; }
.svc-trigger:focus-within,
.svc-open .svc-trigger         { border-color: #5ca7de; box-shadow: 0 0 0 4px rgba(50,128,199,.12); }

/* منطقة الـ tags + الـ placeholder جوا الـ trigger */
.svc-tags-wrap {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    min-height: 26px;
}
.svc-placeholder {
    color: #8a9db0;
    font-size: .9rem;
    pointer-events: none;
    line-height: 1.5;
}
.svc-placeholder.hidden { display: none; }

.svc-chevron {
    flex-shrink: 0;
    color: #9bafc0;
    transition: transform .2s;
    margin-inline-start: auto;
}
.svc-open .svc-chevron { transform: rotate(180deg); }

/* الـ dropdown */
.svc-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: #fff;
    border: 1.5px solid #cfdae6;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(15,40,80,.13);
    z-index: 300;
    padding: .4rem;
    max-height: 250px;
    overflow-y: auto;
}
.svc-open .svc-dropdown { display: block; }

/* خيارات الـ dropdown */
.svc-option {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .44rem .65rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .875rem;
    color: #3d5166;
    transition: background .1s;
    user-select: none;
}
.svc-option:hover                  { background: #f0f7fd; }
.svc-option input[type="checkbox"] { display: none; }
.svc-opt-tick {
    flex-shrink: 0;
    width: 16px; height: 16px;
    border: 1.5px solid #9bafc0;
    border-radius: 4px;
    background: #fff;
    position: relative;
    transition: background .12s, border-color .12s;
}
.svc-option.checked                { color: #174e87; font-weight: 600; }
.svc-option.checked .svc-opt-tick  { background: #2d7dc5; border-color: #2d7dc5; }
.svc-option.checked .svc-opt-tick::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 4.5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translate(-50%, -62%) rotate(-45deg);
}

/* tags جوا الـ trigger */
.svc-tag {
    display: inline-flex;
    align-items: center;
    gap: .22rem;
    padding: .16rem .42rem .16rem .36rem;
    background: #e5f1fb;
    border: 1px solid #bad4ed;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    color: #174e87;
    white-space: nowrap;
}
.svc-tag-name { line-height: 1.4; }
.svc-tag-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    font-size: .85rem;
    line-height: 1;
    color: #5a8ab8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: background .1s, color .1s;
}
.svc-tag-x:hover { background: #c9e0f5; color: #c0392b; }

/* ── Rich Text Editor ───────────────────────────────────────────── */
.rte-wrap {
    border: 1.5px solid #cfdae6;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.rte-wrap:focus-within {
    border-color: #5ca7de;
    box-shadow: 0 0 0 4px rgba(50,128,199,.12);
}
.rte-toolbar {
    display: flex;
    align-items: center;
    gap: .15rem;
    padding: .3rem .45rem;
    border-bottom: 1px solid #e8f0f7;
    background: #f8fbfe;
    flex-wrap: wrap;
}
.rte-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: #4a6073;
    font-size: .82rem;
    font-family: inherit;
    transition: background .1s, border-color .1s, color .1s;
    flex-shrink: 0;
}
.rte-btn:hover  { background: #e8f2fb; border-color: #c8ddef; }
.rte-btn.active { background: #ddeeff; border-color: #aacde8; color: #1a4f82; }
.rte-sep { width: 1px; height: 18px; background: #dbe6f0; margin: 0 .2rem; flex-shrink: 0; }
.rte-editor {
    min-height: 110px;
    max-height: 380px;
    overflow-y: auto;
    padding: .65rem .85rem;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.75;
    color: var(--text);
    outline: none;
    direction: rtl;
    word-break: break-word;
}
.rte-editor:empty::before {
    content: attr(data-placeholder);
    color: #a0b0c0;
    pointer-events: none;
}
.rte-editor ul,
.rte-editor ol  { padding-inline-start: 1.6rem; margin: .25rem 0; }
.rte-editor li  { margin: .1rem 0; }
.rte-editor p   { margin: .2rem 0; }
.rte-editor b,
.rte-editor strong { font-weight: 700; }
/* ── RTE link bar ───────────────────────────────────────────────── */
.rte-link-bar { display: none; align-items: center; gap: .4rem; padding: .3rem .55rem; background: #f0f6fc; border-bottom: 1px solid #dce8f4; }
.rte-link-bar.open { display: flex; }
.rte-link-input { flex: 1; min-width: 0; padding: .24rem .5rem; font-size: .8rem; border: 1px solid #c8ddf0; border-radius: 6px; outline: none; direction: ltr; background: #fff; }
.rte-link-input:focus { border-color: #5ca7de; }
.rte-link-ok, .rte-link-cancel { padding: .2rem .6rem; font-size: .78rem; border-radius: 6px; border: 1px solid; cursor: pointer; white-space: nowrap; }
.rte-link-ok     { background: #1a6eb5; color: #fff; border-color: #1a6eb5; }
.rte-link-ok:hover { background: #155fa0; }
.rte-link-cancel { background: #fff; color: #555; border-color: #ccc; }
.rte-link-cancel:hover { background: #f5f5f5; }
.rte-editor a  { color: #1a6eb5; text-decoration: underline; cursor: pointer; }
/* كيفية عرض الـ RTE content في صفحات التفاصيل */
.rte-content    { line-height: 1.75; word-break: break-word; }
.rte-content ul,
.rte-content ol { padding-inline-start: 1.5rem; margin: .25rem 0; }
.rte-content li { margin: .1rem 0; }
.rte-content p  { margin: .2rem 0; }
.rte-content a  { color: #1a6eb5; text-decoration: underline; }

/* ── Summary badge pills ────────────────────────────────────────── */
.badge-sum          { padding: .3rem .75rem; border-radius: 8px; font-size: .82rem; font-weight: 700; display: inline-block; }
.badge-sum--green   { background: #d1fae5; color: #1a7a5e; }
.badge-sum--neutral { background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); }
.badge-sum--danger  { background: #fee2e2; color: #b52533; }

/* ── Summary header (installments section) ──────────────────────── */
.summary-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.summary-badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-inline-start: auto; }

/* ── Compact table (installments / payment details) ─────────────── */
.table-compact { font-size: .88rem; }
.table-compact th, .table-compact td { padding: .5rem .7rem; }
.table-compact thead tr { background: var(--surface-soft); border-bottom: 2px solid var(--line); }
.table-compact tbody tr { border-bottom: 1px solid var(--line); }
.table-compact tfoot tr { background: var(--surface-soft); font-weight: 700; border-top: 2px solid var(--line); }

/* ── Dashed separator ───────────────────────────────────────────── */
.dashed-top { border-top: 2px dashed var(--line); padding-top: 1rem; }

/* ── Invoice items table header ─────────────────────────────────── */
.invoice-thead-row    { background: var(--primary); color: #fff; }

/* ── Invoice item rows (JS-generated) ──────────────────────────── */
#itemsBody .item-num-cell { padding: .45rem .6rem; color: var(--muted); text-align: center; }
#itemsBody .item-cell     { padding: .35rem .5rem; }
#itemsBody .item-total    { padding: .45rem .6rem; text-align: left; font-weight: 700; }
.item-qty-input    { text-align: center; }
.item-price-input  { text-align: left; }
.item-sm-input, .item-sm-select { font-size: .84rem; }
.item-del-btn { background: var(--danger); border: 0; color: #fff; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ── Button color variants ──────────────────────────────────────── */
.btn-green  { background: linear-gradient(135deg, #10b981, #059669); }
.btn-accent { background: linear-gradient(135deg, var(--accent), #0a8a89); }

/* ── Totals live-preview box (create/edit invoice) ──────────────── */
.totals-preview { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.totals-preview .totals-row { font-size: .9rem; }

/* ── Text helpers ───────────────────────────────────────────────── */
.text-danger  { color: var(--danger); font-weight: 700; }
.text-primary { color: var(--primary); font-weight: 700; }
.text-accent  { color: var(--accent); font-weight: 700; }
.text-sm      { font-size: .83rem; }
.text-xs      { font-size: .78rem; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }

/* ── Flex helpers ───────────────────────────────────────────────── */
.flex-1   { flex: 1; min-width: 0; }
.flex-end { display: flex; justify-content: flex-end; }
.gap-4    { gap: .25rem; }
.gap-5    { gap: .5rem; }
.gap-75   { gap: .75rem; }

/* ── Spacing utility ────────────────────────────────────────────── */
.mb-sm { margin-bottom: .75rem; }

/* ── Table column utilities ─────────────────────────────────────── */
.th-num   { color: #aab4c0; font-weight: 400; font-size: .78rem; }
.td-num   { color: #aab4c0; font-size: .8rem; }
.tbl-link { font-weight: 700; color: var(--primary); text-decoration: none; }
.tbl-sub  { font-size: .73rem; color: var(--muted); margin-top: .15rem; }
.td-muted  { color: var(--muted); }
.td-sm     { font-size: .83rem; }
.td-nowrap { white-space: nowrap; }
.td-center      { text-align: center; }
.td-left        { text-align: left; }
.td-id          { color: #aab4c0; font-size: .8rem; }
.th-id          { color: #aab4c0; font-weight: 400; font-size: .78rem; }
.td-seq         { color: var(--muted); text-align: center; font-size: .8rem; }
.item-svc-tag   { display: block; color: var(--accent); font-weight: 700; font-size: .78rem; }
.sb-field--flex { flex: 3; min-width: 180px; }
.tbl-empty { text-align: center; color: var(--muted); padding: 2rem; }
.text-muted     { color: var(--muted); }
.text-warn      { color: #f59e0b; }
.text-confirmed { color: #1a7a5e; }
.m-0            { margin: 0; }
.card-section-title--flex { display: flex; align-items: center; gap: .4rem; }
.page-header--top          { align-items: flex-start; }
.sidebar-nav               { padding-bottom: .5rem; }
.hint-text  { font-size: .83rem; color: var(--muted); display: block; margin-top: .25rem; }

/* ── Progress row (table cells) ─────────────────────────────────── */
.progress-row       { display: flex; align-items: center; gap: .4rem; }
.progress-track--sm { flex: 1; height: 7px; min-width: 60px; }
.pct-lbl            { font-size: .75rem; color: var(--muted); white-space: nowrap; font-weight: 700; }
.td-progress        { min-width: 120px; }

/* ── Task bubble dots ───────────────────────────────────────────── */
.task-bubbles        { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.td-tasks            { max-width: 160px; }
.task-dot            { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid; text-decoration: none; font-size: .65rem; font-weight: 900; flex-shrink: 0; }
.task-dot--done      { background: #10b981; border-color: #10b981; color: #fff; }
.task-dot--progress  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.task-dot--blocked   { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.task-dot--other     { background: #fff; border-color: #cbd5e1; color: #94a3b8; }

/* ── File type badges ───────────────────────────────────────────── */
.ft-badge { display: inline-block; padding: .1rem .42rem; border-radius: 5px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.ft-image { background: #dbeafe; color: #1e40af; }
.ft-pdf   { background: #fee2e2; color: #b91c1c; }
.ft-doc   { background: #dbeafe; color: #1e3a8a; }
.ft-xls   { background: #d1fae5; color: #065f46; }
.ft-ppt   { background: #ffedd5; color: #9a3412; }
.ft-zip   { background: #fef3c7; color: #92400e; }
.ft-video { background: #f3e8ff; color: #6b21a8; }
.ft-audio { background: #fce7f3; color: #9d174d; }
.ft-text, .ft-other { background: #f1f5f9; color: #475569; }

/* ── Search bar field sizing ─────────────────────────────────────── */
.sb-field     { min-width: 130px; }
.sb-field--lg { flex: 2; min-width: 150px; }
.sb-field--md { flex: 1; min-width: 130px; }

/* ── Attachment / files table helpers ───────────────────────────── */
.flex-row-wrap    { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tbl-name         { font-size: .87rem; font-weight: 600; }
.tbl-sub-sm       { font-size: .75rem; color: var(--muted); }
.line-clamp-2     { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-placeholder { color: #c0cad5; }
.chip-tag         { display: inline-block; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; font-size: .82rem; }

/* ── Payment create: balance box + installment bar ──────────────── */
.balance-box      { margin-top: .4rem; padding: .45rem .75rem; border-radius: 8px; background: var(--surface-soft); border: 1px solid var(--line); font-size: .85rem; }
.install-bar      { margin-top: 1rem; padding: 1rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.install-bar-hdr  { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 700; margin-bottom: .5rem; }
.progress-bar--gradient { background: linear-gradient(90deg, var(--accent), var(--primary)); }

/* ── Notes block (show pages) ───────────────────────────────────── */
.notes-box { margin-top: .75rem; padding: .6rem; background: var(--surface-soft); border-radius: 8px; font-size: .88rem; color: var(--muted); }

/* ── Button: deep-primary (invoice link buttons) ────────────────── */
.btn-invoice  { background: linear-gradient(135deg, var(--primary), #1e40af); }
.btn-payment  { background: linear-gradient(135deg, #1a7a5e, #2d9e7b); }

/* ── Status badge modifiers ─────────────────────────────────────── */
.status-badge--sm { font-size: .8rem; margin-inline-start: .5rem; }

/* ── Auth page layout helpers ───────────────────────────────────── */
.auth-center    { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.auth-subtitle  { color: var(--muted); font-size: .9rem; margin-top: -.3rem; }
.auth-footer    { text-align: center; margin-top: 1.2rem; font-size: .87rem; }
.link-primary   { color: var(--primary); text-decoration: none; }
.link-muted     { color: var(--muted); text-decoration: none; }
.mb-form        { margin-bottom: 1rem; }
.input-disabled { background: var(--surface-soft) !important; color: var(--muted); }
.input-otp      { letter-spacing: .35rem; font-size: 1.15rem; text-align: center; }
.input-eye-wrap { position: relative; }
.eye-btn        { position: absolute; left: .55rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); }
.btn-full       { width: 100%; }

/* ── sbadge — status pill (global, also in dashboard.css) ──────── */
.sbadge { display: inline-flex; align-items: center; padding: .18rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; color: #fff; white-space: nowrap; }

/* ── Spacing helpers ────────────────────────────────────────────── */
.mb-md         { margin-bottom: 1.2rem; }
.flex-shrink-0 { flex-shrink: 0; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Section label (for "ملفات المشروع" headings) ───────────────── */
.section-label { display: block; font-weight: 600; margin-bottom: .4rem; }

/* ── Dropzone (file upload widget) ─────────────────────────────── */
.dropzone           { border: 2px dashed var(--line,#e2e8f0); border-radius: 10px; padding: 1.2rem 1rem; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--surface-soft,#f8fafc); }
.dropzone-icon      { color: var(--muted); display: block; margin: 0 auto .4rem; }
.dropzone-hint      { margin: .2rem 0 .45rem; color: var(--muted); font-size: .85rem; }
.dropzone-btn       { display: inline-block; padding: .28rem .8rem; background: var(--primary,#0f4c81); color: #fff; border-radius: 7px; cursor: pointer; font-size: .83rem; font-weight: 600; }
.dropzone-file-list     { margin-top: .55rem; text-align: right; }
.dropzone-file-list ul  { list-style: none; padding: 0; margin: 0; }
.proj-file-li           { list-style: none; padding: .2rem .35rem; font-size: .82rem; display: flex; justify-content: space-between; gap: .8rem; }

/* ── File info card (files/edit header banner) ──────────────────── */
.file-info-card { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1.2rem; display: flex; align-items: center; gap: .9rem; }

/* ── Warning / optional-replace box ────────────────────────────── */
.warn-box        { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1.2rem; }
.warn-box-hdr    { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.warn-box-title  { margin: 0; font-size: .85rem; font-weight: 700; color: #92400e; }
.warn-box-hint   { margin: 0 0 .55rem; font-size: .78rem; color: #78350f; }
.warn-toggle-btn { background: none; border: 1px solid #fcd34d; border-radius: 6px; padding: .2rem .6rem; font-size: .78rem; cursor: pointer; color: #92400e; font-family: inherit; }

/* ── Notification bell ──────────────────────────────────────────── */
.notif-bell          { position: relative; }
.notif-bell-btn      { position: relative; }
.notif-badge         { position: absolute; top: 2px; left: 2px; min-width: 17px; height: 17px; background: #dc2626; color: #fff; font-size: .62rem; font-weight: 800; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 3px; pointer-events: none; line-height: 1; }
.notif-badge--hidden { display: none; }

.notif-panel         { position: absolute; top: calc(100% + .5rem); left: 0; width: 340px; background: var(--card,#fff); border: 1px solid var(--line,#e2e8f0); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.13); z-index: 9999; overflow: hidden; }
.notif-panel[hidden] { display: none; }
.notif-panel-head    { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--line,#e2e8f0); }
.notif-panel-title   { font-weight: 700; font-size: .9rem; }
.notif-mark-all-btn  { background: none; border: none; cursor: pointer; font-size: .78rem; color: var(--primary,#0f4c81); font-family: inherit; padding: 0; }
.notif-mark-all-btn:hover { text-decoration: underline; }
.notif-empty         { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem; margin: 0; }
.notif-drop-list     { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.notif-drop-item     { border-bottom: 1px solid var(--line,#e2e8f0); }
.notif-drop-item:last-child { border-bottom: none; }
.notif-drop-item--unread { background: var(--primary-tint,#eff6ff); }
.notif-drop-link     { display: flex; align-items: flex-start; gap: .55rem; padding: .65rem 1rem; width: 100%; text-align: right; background: none; border: none; cursor: pointer; font-family: inherit; font-size: inherit; color: inherit; text-decoration: none; }
.notif-drop-link:hover { background: var(--surface-soft,#f8fafc); }
.notif-drop-link--plain { cursor: default; }
.notif-drop-dot      { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--primary,#0f4c81); margin-top: .35rem; }
.notif-drop-item--read .notif-drop-dot,
.notif-drop-item:not(.notif-drop-item--unread) .notif-drop-dot { background: transparent; border: 1.5px solid var(--muted,#94a3b8); }
.notif-drop-text     { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.notif-drop-title    { font-weight: 600; font-size: .82rem; line-height: 1.4; color: var(--text,#1e293b); }
.notif-drop-body     { font-size: .77rem; color: var(--muted,#64748b); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-drop-time     { font-size: .72rem; color: var(--muted,#94a3b8); }
.notif-view-all      { display: block; text-align: center; padding: .6rem 1rem; font-size: .82rem; font-weight: 600; color: var(--primary,#0f4c81); text-decoration: none; border-top: 1px solid var(--line,#e2e8f0); }
.notif-view-all:hover { background: var(--surface-soft,#f8fafc); }

/* ── Notifications page list ────────────────────────────────────── */
.notif-list          { list-style: none; margin: 0; padding: 0; }
.notif-item          { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line,#e2e8f0); }
.notif-item:last-child { border-bottom: none; }
.notif-item--unread  { background: var(--primary-tint,#eff6ff); border-radius: 8px; margin-bottom: 2px; }
.notif-dot           { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--primary,#0f4c81); margin-top: .45rem; }
.notif-item--read .notif-dot { background: transparent; border: 1.5px solid var(--muted,#94a3b8); }
.notif-content       { flex: 1; min-width: 0; }
.notif-title         { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; }
.notif-body          { font-size: .83rem; color: var(--muted,#64748b); margin-bottom: .25rem; }
.notif-meta          { font-size: .75rem; color: var(--muted,#94a3b8); }
.notif-actions       { flex-shrink: 0; }
.pagination          { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line,#e2e8f0); }
.page-header         { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.page-header h1      { margin: 0; }
.input-file      { font-family: inherit; font-size: .85rem; width: 100%; }
