/* ============================================================
   منظومة الوحدات السكنية — جامعة الموصل
   Complete RTL CSS System — Professional Design
   ============================================================ */

:root {
    --blue:        #1a6fb5;
    --blue-dark:   #155a96;
    --blue-light:  #e8f2fb;
    --gold:        #c8860a;
    --gold-dark:   #a36d08;
    --gold-light:  #fef5e4;
    --green:       #1d7a4e;
    --green-light: #e6f5ee;
    --red:         #c0392b;
    --red-light:   #fdecea;
    --gray:        #6b7280;
    --gray-light:  #f3f4f6;
    --white:       #ffffff;
    --bg:          #f0f4f8;
    --border:      #dde3ea;
    --text:        #1f2937;
    --text-sm:     #6b7280;
    --font:        'Tajawal', 'Segoe UI', sans-serif;
    --shadow:      0 1px 6px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.16);
    --radius:      12px;
    --radius-sm:   8px;
    --radius-xs:   4px;
    --transition:  all 0.2s ease;
    --sidebar-w:   260px;
    --topbar-h:    64px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.65;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
ul, ol { list-style: none; }

/* ── Typography ── */
h1 { font-size: 1.9rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }
.text-muted    { color: var(--text-sm); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }

/* ══════════════════════════════════════════════════
   APP LAYOUT — Sidebar + Main
══════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0; right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, #0f3460 0%, #1a6fb5 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo .logo-icon {
    width: 42px; height: 42px;
    background: var(--gold);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: white;
    flex-shrink: 0;
}
.sidebar-logo .logo-text { line-height: 1.3; }
.sidebar-logo .logo-text span { display: block; color: white; font-weight: 700; font-size: 0.85rem; }
.sidebar-logo .logo-text small { color: rgba(255,255,255,0.6); font-size: 0.72rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin: 10px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
    width: 38px; height: 38px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}
.sidebar-user .user-name { color: white; font-weight: 600; font-size: 0.85rem; }
.sidebar-user .user-role { color: rgba(255,255,255,0.6); font-size: 0.72rem; }

.nav-section { padding: 6px 0; }
.nav-section-title {
    color: rgba(255,255,255,0.45);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 20px 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-right: 3px solid transparent;
    cursor: pointer;
    width: 100%;
    text-align: right;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-right-color: var(--gold);
    font-weight: 600;
}
.nav-badge {
    margin-right: auto;
    background: var(--gold);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 6px 16px;
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    z-index: 50;
    box-shadow: var(--shadow);
}
.topbar .page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-date {
    color: var(--text-sm);
    font-size: 0.8rem;
    display: flex; align-items: center; gap: 6px;
    background: var(--gray-light);
    padding: 5px 12px;
    border-radius: 20px;
}
.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray);
    transition: var(--transition);
    font-size: 0.95rem;
    background: var(--gray-light);
}
.btn-icon:hover { background: var(--blue-light); color: var(--blue); }

.sidebar-toggle { display: none; }

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ════════════════════════════════════════
   PUBLIC LAYOUT — Header + Footer
════════════════════════════════════════ */
.public-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pub-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a6fb5 100%);
    color: white;
    padding: 0;
}
.pub-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 40px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.pub-header-brand {
    display: flex; align-items: center; gap: 16px;
}
.pub-header-brand img { width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); }
.pub-header-brand .brand-text .title { font-size: 1.1rem; font-weight: 700; }
.pub-header-brand .brand-text .sub   { font-size: 0.78rem; color: rgba(255,255,255,0.75); margin-top: 2px; }
.pub-header-actions { display: flex; align-items: center; gap: 12px; }
.pub-header-social { display: flex; gap: 10px; }
.pub-nav-toggle {
    display: none;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-xs);
    color: white; font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.pub-nav-toggle:hover { background: rgba(255,255,255,0.28); }
.pub-header-social a {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.85rem;
    transition: var(--transition);
}
.pub-header-social a:hover { background: var(--gold); }

.pub-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 40px;
}
.pub-nav a {
    display: flex; align-items: center; gap: 7px;
    padding: 14px 18px;
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}
.pub-nav a:hover, .pub-nav a.active {
    color: white;
    border-bottom-color: var(--gold);
    background: rgba(255,255,255,0.08);
}
.nav-logout-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 14px 18px;
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}
.nav-logout-btn:hover {
    color: white;
    border-bottom-color: var(--gold);
    background: rgba(255,255,255,0.08);
}

.pub-main { flex: 1; }

.pub-footer {
    background: #0f3460;
    color: rgba(255,255,255,0.85);
    padding: 40px 40px 20px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 30px;
}
.footer-col h4 { color: var(--gold); font-size: 0.95rem; margin-bottom: 14px; }
.footer-col a, .footer-col p {
    display: block; font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 7px;
    transition: var(--transition);
}
.footer-col a:hover { color: var(--gold); }
.footer-social { display: flex; gap: 10px; margin-top: 10px; }
.footer-social a {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.9rem;
    transition: var(--transition);
}
.footer-social a:hover { background: var(--gold); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 16px;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}

/* ════════════════════════════════════════
   HERO SECTION
════════════════════════════════════════ */
.hero {
    background: linear-gradient(135deg, #0f3460 0%, #1a6fb5 70%, #2980b9 100%);
    padding: 70px 40px;
    text-align: center;
    color: white;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 14px; }
.hero p  { font-size: 1.05rem; color: rgba(255,255,255,0.85); max-width: 600px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ════════════════════════════════════════
   COMPONENTS
════════════════════════════════════════ */

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: var(--blue-light); color: var(--blue); }
.stat-icon.gold   { background: var(--gold-light);  color: var(--gold); }
.stat-icon.green  { background: var(--green-light); color: var(--green); }
.stat-icon.red    { background: var(--red-light);   color: var(--red); }
.stat-body .stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-body .stat-label { font-size: 0.78rem; color: var(--text-sm); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary   { background: var(--blue);  color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-gold      { background: var(--gold);  color: white; border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-dark); }
.btn-success   { background: var(--green); color: white; border-color: var(--green); }
.btn-danger    { background: var(--red);   color: white; border-color: var(--red); }
.btn-secondary { background: var(--gray-light); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline   { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}
.form-label .required { color: var(--red); margin-right: 3px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--white);
    transition: var(--transition);
    direction: rtl;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,111,181,0.12);
}
.form-control.is-invalid { border-color: var(--red); }
.form-control::placeholder { color: #b0b8c1; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-left: 36px; }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-hint { font-size: 0.78rem; color: var(--text-sm); margin-top: 5px; }

/* ── Password show/hide wrapper ── */
.pw-wrap {
    position: relative;
    display: block;
}
.pw-wrap .form-control {
    padding-inline-end: 44px;
}
.pw-toggle-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-sm);
    font-size: 1rem;
    transition: color 0.2s;
    z-index: 50;
}
.pw-toggle-btn:hover { color: var(--blue); }
.form-error { font-size: 0.78rem; color: var(--red); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Tables */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--gray-light);
    padding: 12px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-sm);
    text-align: right;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-light); }
.table-actions { display: flex; gap: 6px; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
}
.badge-blue    { background: var(--blue-light);  color: var(--blue); }
.badge-gold    { background: var(--gold-light);  color: var(--gold); }
.badge-green   { background: var(--green-light); color: var(--green); }
.badge-red     { background: var(--red-light);   color: var(--red); }
.badge-gray    { background: var(--gray-light);  color: var(--gray); }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.88rem;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-info    { background: var(--blue-light);  color: var(--blue-dark); border: 1px solid #b3d4f0; }
.alert-success { background: var(--green-light); color: var(--green);     border: 1px solid #a3d5b9; }
.alert-danger  { background: var(--red-light);   color: var(--red);       border: 1px solid #f5bab4; }
.alert-warning { background: var(--gold-light);  color: var(--gold-dark); border: 1px solid #f0c97a; }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%; max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--gray-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray); font-size: 0.9rem;
    transition: var(--transition);
}
.modal-close:hover { background: var(--red-light); color: var(--red); }
.modal-body    { padding: 22px; }
.modal-footer  { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 12px;
    min-width: 280px; max-width: 360px;
    font-size: 0.88rem;
    animation: slideInLeft 0.3s ease;
    border-right: 4px solid var(--blue);
}
.toast.success { border-right-color: var(--green); }
.toast.error   { border-right-color: var(--red); }
.toast.warning { border-right-color: var(--gold); }
.toast i { font-size: 1.1rem; }
.toast.success i { color: var(--green); }
.toast.error   i { color: var(--red); }
.toast.warning i { color: var(--gold); }
.toast-msg { flex: 1; }
.toast-close { color: var(--text-sm); font-size: 0.8rem; cursor: pointer; }
@keyframes slideInLeft { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f3460 0%, #1a6fb5 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo img { width: 72px; border-radius: 50%; border: 3px solid var(--border); }
.auth-logo h2 { font-size: 1.2rem; margin-top: 12px; color: var(--blue-dark); }
.auth-logo p  { font-size: 0.8rem; color: var(--text-sm); margin-top: 4px; }
.auth-divider {
    text-align: center; position: relative; margin: 22px 0;
    color: var(--text-sm); font-size: 0.8rem;
}
.auth-divider::before {
    content: ''; position: absolute; top: 50%; right: 0;
    width: calc(50% - 30px); height: 1px; background: var(--border);
}
.auth-divider::after {
    content: ''; position: absolute; top: 50%; left: 0;
    width: calc(50% - 30px); height: 1px; background: var(--border);
}

/* Profile Page */
.profile-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.profile-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a6fb5 100%);
    padding: 40px 32px;
    text-align: center;
    color: white;
}
.profile-avatar {
    width: 80px; height: 80px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: white; font-weight: 700;
    margin: 0 auto 14px;
    border: 3px solid rgba(255,255,255,0.4);
}
.profile-header h2 { font-size: 1.3rem; }
.profile-header p  { font-size: 0.82rem; color: rgba(255,255,255,0.75); margin-top: 4px; }
.profile-body { padding: 32px; }

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.action-card {
    background: var(--gray-light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    color: var(--text);
}
.action-card:hover { border-color: var(--blue); background: var(--blue-light); color: var(--blue); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.action-card i { font-size: 2rem; display: block; margin-bottom: 10px; }
.action-card span { font-size: 0.82rem; font-weight: 600; }
.action-card.gold:hover { border-color: var(--gold); background: var(--gold-light); color: var(--gold); }
.action-card.green:hover { border-color: var(--green); background: var(--green-light); color: var(--green); }
.action-card.red:hover { border-color: var(--red); background: var(--red-light); color: var(--red); }

/* Public flash wrapper */
.pub-flash-wrap { padding: 0 40px; margin-top: 14px; }

/* Table scroll shadow indicator */
.table-wrapper {
    position: relative;
}
.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 24px; height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.table-wrapper.scrollable::after { opacity: 1; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.page-btn {
    min-width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    color: var(--text);
    transition: var(--transition);
    background: white;
}
.page-btn:hover  { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.page-btn.active { background: var(--blue); color: white; border-color: var(--blue); font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Search & Filter Bar */
.filter-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.search-box {
    position: relative; flex: 1; min-width: 200px;
}
.search-box input { padding-right: 40px; }
.search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-sm); font-size: 0.9rem; }

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-left: 6px;
}
.status-dot.green  { background: var(--green); }
.status-dot.red    { background: var(--red); }
.status-dot.gold   { background: var(--gold); }
.status-dot.blue   { background: var(--blue); }

/* Section headings */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
    margin-bottom: 20px;
}
.section-title { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title i { color: var(--blue); }

/* Breadcrumb */
.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.8rem; color: var(--text-sm);
    margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { color: var(--border); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-sm);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 0.85rem; }

/* Loading spinner */
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Image preview */
.img-preview {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ── Print ── */
@media print {
    .sidebar, .topbar, .no-print,
    .sidebar-toggle, .sidebar-overlay,
    .pub-nav-toggle, .pub-header-social,
    .pub-footer, .breadcrumb { display: none !important; }
    .main-content { margin-right: 0 !important; }
    body { background: white; font-size: 13px; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .pub-header { background: white !important; color: black !important; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
}

/* ════════════════════════════════════════
   RESPONSIVE — Mobile-first breakpoints
   1024 → 992 → 768 → 576 → 400
════════════════════════════════════════ */

/* ── 1024px: Tablets landscape — sidebar becomes overlay ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
        width: var(--sidebar-w);
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.show { display: block; }

    .main-content { margin-right: 0; }
    .sidebar-toggle { display: flex; }
    .page-content { padding: 20px; }
}

/* ── 992px: Tablets — column collapses ── */
@media (max-width: 992px) {
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ── 768px: Tablets portrait / large phones ── */
@media (max-width: 768px) {

    /* Typography */
    h1 { font-size: 1.55rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    /* ─ Public Header ─ */
    .pub-header-top { padding: 11px 16px; }
    .pub-header-brand img { width: 44px; height: 44px; }
    .pub-header-brand .brand-text .title { font-size: 0.95rem; }
    .pub-header-brand .brand-text .sub   { font-size: 0.7rem; }
    .pub-header-social { display: none; }
    .pub-nav-toggle    { display: flex; }

    /* ─ Mobile nav drawer ─ */
    .pub-nav {
        flex-direction: column;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.32s ease;
    }
    .pub-nav.mobile-open { max-height: 600px; }
    .pub-nav a, .pub-nav .nav-logout-btn {
        padding: 13px 20px;
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        white-space: normal;
        width: 100%;
        border-left: none;
        border-right: none;
        border-top: none;
        border-radius: 0;
    }
    .pub-nav a:last-child,
    .pub-nav form:last-child .nav-logout-btn { border-bottom: none; }

    /* Flash in public layout */
    .pub-flash-wrap { padding: 0 16px; }

    /* ─ Hero ─ */
    .hero { padding: 44px 16px; }
    .hero h1 { font-size: 1.55rem; }
    .hero p  { font-size: 0.95rem; }

    /* ─ Footer ─ */
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .pub-footer  { padding: 24px 16px 14px; }

    /* ─ Admin ─ */
    .page-content { padding: 14px; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar .page-title { font-size: 0.95rem; }

    /* ─ Stats ─ */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* ─ Forms ─ */
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    /* ─ Cards ─ */
    .card { padding: 16px; }
    .card-header { padding-bottom: 12px; margin-bottom: 14px; }

    /* ─ Section header ─ */
    .section-header { align-items: flex-start; }

    /* ─ Profile ─ */
    .profile-header { padding: 28px 18px; }
    .profile-body   { padding: 20px 16px; }

    /* ─ Action grid ─ */
    .action-grid { grid-template-columns: repeat(2, 1fr); }

    /* ─ Filter bar ─ */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 0; }

    /* ─ Auth card ─ */
    .auth-card { padding: 30px 22px; }
}

/* ── 576px: Phones ── */
@media (max-width: 576px) {
    html { font-size: 14px; }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }

    /* ─ Stats: single column ─ */
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card  { padding: 14px 16px; }
    .stat-icon  { width: 46px; height: 46px; font-size: 1.25rem; }
    .stat-body .stat-value { font-size: 1.45rem; }

    /* ─ Topbar ─ */
    .topbar { padding: 0 12px; }
    .topbar-date { display: none; }

    /* ─ Sidebar full-width on very small phones ─ */
    .sidebar { width: min(280px, 85vw); }

    /* ─ Admin: tighter ─ */
    .page-content { padding: 12px; }

    /* ─ Tables: compact ─ */
    thead th { padding: 10px 10px; font-size: 0.75rem; }
    tbody td { padding: 10px 10px; font-size: 0.8rem;  }
    .table-actions { flex-wrap: wrap; gap: 4px; }
    .btn-sm { padding: 5px 10px; font-size: 0.75rem; }

    /* ─ Cards ─ */
    .card { padding: 13px; }

    /* ─ Section header buttons ─ */
    .section-header > div { display: flex; flex-wrap: wrap; gap: 6px; }

    /* ─ Hero ─ */
    .hero { padding: 34px 14px; }
    .hero h1 { font-size: 1.35rem; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; justify-content: center; }

    /* ─ Profile ─ */
    .profile-avatar  { width: 66px; height: 66px; font-size: 1.6rem; }
    .profile-header  { padding: 22px 14px; }
    .profile-body    { padding: 16px 12px; }
    .profile-header h2 { font-size: 1.1rem; }

    /* ─ Auth ─ */
    .auth-card { padding: 24px 16px; }

    /* ─ Modal: bottom sheet on mobile ─ */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 90vh;
    }

    /* ─ Footer ─ */
    .pub-footer { padding: 20px 14px 12px; }

    /* ─ Public nav ─ */
    .pub-header-top { padding: 10px 14px; }
    .pub-header-brand { gap: 10px; }
    .pub-header-brand img { width: 38px; height: 38px; }
}

/* ── 400px: Very small phones ── */
@media (max-width: 400px) {
    html { font-size: 13.5px; }

    .auth-card { padding: 20px 14px; }
    .page-content { padding: 10px; }
    .card { padding: 11px; }
    .topbar { padding: 0 10px; }

    thead th { padding: 8px; font-size: 0.72rem; }
    tbody td { padding: 8px; font-size: 0.76rem; }

    .btn { padding: 8px 14px; font-size: 0.84rem; }
    .btn-sm { padding: 4px 9px; font-size: 0.72rem; }
    .btn-lg { padding: 11px 20px; font-size: 0.94rem; }

    .hero { padding: 28px 12px; }
    .hero h1 { font-size: 1.25rem; }

    .pub-header-top { gap: 8px; }
    .pub-header-brand .brand-text .title { font-size: 0.88rem; }
}
