/* ═══════════════════════════════════════════════════════
   NFS-SHARE  —  Design System v3
   Brand: #103060 (navy) + white. Flat. No gradients. No shadows. Small radius.
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Brand */
    --primary:       #103060;
    --primary-light: #1a4280;
    --primary-dim:   #e8edf5;

    /* Neutrals */
    --white:         #ffffff;
    --bg:            #f4f6f9;
    --border:        #d0d7e3;
    --text:          #1a1a2e;
    --text-muted:    #6b7280;

    /* Status */
    --success:       #059669;
    --success-bg:    #d1fae5;
    --warning:       #d97706;
    --warning-bg:    #fef3c7;
    --danger:        #dc2626;
    --danger-bg:     #fee2e2;
    --info:          #0369a1;
    --info-bg:       #e0f2fe;

    /* Layout */
    --sidebar-w:     240px;
    --sidebar-w-col: 56px;
    --topbar-h:      56px;
    --radius:        4px;
    --transition:    0.2s ease;
}

/* ── Base ── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ══════════════════════════════════════
   TOP BAR
══════════════════════════════════════ */
.navbar-cls-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid var(--primary-light);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sidebar toggle button in topbar */
#sidebarToggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
}
#sidebarToggle:hover { background: var(--primary-light); }

.topbar-brand {
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.topbar-btn:hover { background: var(--primary-light); color: var(--white); }
.topbar-btn i { font-size: 14px; }

/* ── User menu button ── */
.user-menu { position: relative; }

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.user-menu-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
}

.user-menu-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    color: rgba(255,255,255,0.7);
    font-size: 10px;
    transition: transform .2s;
}
.user-menu-btn.open .user-menu-caret { transform: rotate(180deg); }

/* ── User dropdown ── */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 210px;
    display: none;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    overflow: hidden;
}
.user-dropdown.active { display: block; }

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--primary-dim);
    border-bottom: 1px solid var(--border);
}
.user-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-dropdown-info { min-width: 0; }
.user-dropdown-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-links a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.user-dropdown-links a:last-child { border-bottom: none; }
.user-dropdown-links a:hover { background: var(--primary-dim); color: var(--primary); }
.user-dropdown-links a i { width: 14px; text-align: center; color: var(--text-muted); }

/* ── Notification Bell ── */
.notif-wrap { position: relative; }
.notif-btn  { position: relative; }
.notif-badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: #ef4444; color: #fff;
    font-size: 9px; font-weight: 700; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; line-height: 1;
}
.notif-dropdown {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    width: 320px; background: #fff; border: 1.5px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 9000; overflow: hidden;
}
.notif-dropdown.active { display: block; }
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1.5px solid var(--border);
}
.notif-head-title { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 7px; }
.notif-mark-all { font-size: 11.5px; color: var(--primary); background: none; border: none; cursor: pointer; font-weight: 600; padding: 0; }
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.notif-list::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.notif-list { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; color: var(--text-muted); font-size: 13px; }
.notif-empty i { font-size: 24px; opacity: .3; }
.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px; border-bottom: 1.5px solid #f1f5f9;
    text-decoration: none; color: var(--text); transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8fafc; }
.notif-unread { background: #f0f5ff; }
.notif-unread:hover { background: #e8eef9; }
.notif-item-icon {
    width: 32px; height: 32px; border-radius: 50%; background: #e8eef6;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 13px; flex-shrink: 0;
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-msg  { font-size: 12.5px; color: var(--text); margin: 0 0 3px; line-height: 1.4; }
.notif-item-time { font-size: 11px; color: var(--text-muted); }
.notif-footer { border-top: 1.5px solid var(--border); padding: 10px 16px; text-align: center; }
.notif-view-all { font-size: 12.5px; color: var(--primary); font-weight: 600; text-decoration: none; }
.notif-view-all:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.navbar-side {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--primary);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    transition: width var(--transition);
    display: flex;
    flex-direction: column;
}

/* Collapsed state */
.navbar-side.collapsed { width: var(--sidebar-w-col); }

/* Scrollbar */
.navbar-side::-webkit-scrollbar { width: 4px; }
.navbar-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* Nav menu */
.nav-menu { list-style: none; padding: 8px 0; flex: 1; }
.nav-item { margin: 1px 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.nav-link:hover {
    background: var(--primary-light);
    color: var(--white);
}
.nav-link.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
    border-left-color: var(--white);
    font-weight: 600;
}
.nav-link i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.nav-link .nav-label { transition: opacity var(--transition); }

/* Collapsed — hide labels */
.navbar-side.collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
    flex-shrink: 1;
}
.navbar-side.collapsed .has-submenu::after { display: none; }
.navbar-side.collapsed .submenu { display: none !important; }
.navbar-side.collapsed .nav-link {
    padding: 10px 0;
    justify-content: center;
    gap: 0;
}

/* Submenu arrow */
.has-submenu::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    margin-left: auto;
    transition: transform var(--transition);
    flex-shrink: 0;
}
.has-submenu.open::after { transform: rotate(180deg); }

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}
.submenu.open { max-height: 400px; }
.submenu .nav-link {
    padding: 8px 16px 8px 46px;
    font-size: 12px;
    border-left: none;
}
.submenu .nav-link:hover { background: rgba(255,255,255,0.08); }
.submenu .nav-link.active {
    color: var(--white);
    background: rgba(255,255,255,0.1);
    border-left: none;
    font-weight: 600;
}

/* Logout */
.logout-section { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn {
    width: 100%;
    padding: 9px 12px;
    background: rgba(220,38,38,0.15);
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: var(--radius);
    color: #fca5a5;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.logout-btn:hover { background: rgba(220,38,38,0.3); color: white; }
.navbar-side.collapsed .logout-btn { padding: 9px; justify-content: center; }
.navbar-side.collapsed .logout-label { display: none; }

/* Mobile sidebar */
@media (max-width: 768px) {
    .navbar-side { left: calc(-1 * var(--sidebar-w)); width: var(--sidebar-w) !important; }
    .navbar-side.mobile-open { left: 0; }
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-w);
    padding: calc(var(--topbar-h) + 20px) 20px 20px;
    min-height: 100vh;
    transition: margin-left var(--transition);
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-w-col); }

@media (max-width: 768px) {
    .main-content { margin-left: 0 !important; }
}

/* Page title row */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-header h3, .card-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.card-body { padding: 16px; }

.card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Stat cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stats-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-left: 3px solid var(--primary);
}
.stats-card .icon {
    width: 44px;
    height: 44px;
    background: var(--primary-dim);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}
.stats-card h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.stats-card p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.table-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.table-header {
    padding: 12px 16px;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.table-header h3, .table-header p {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--white);
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table, table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th, table.table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-dim);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr, table.table tbody tr {
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child, table.table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover, table.table tbody tr:hover { background: var(--primary-dim); }
.data-table tbody td, table.table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    color: var(--text);
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary   { background: var(--primary);  color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: var(--white); }

.btn-success   { background: var(--success);  color: var(--white); border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; color: var(--white); }

.btn-danger    { background: var(--danger);   color: var(--white); border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: var(--white); }

.btn-warning   { background: var(--warning);  color: var(--white); border-color: var(--warning); }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: var(--white); }

.btn-info      { background: var(--info);     color: var(--white); border-color: var(--info); }
.btn-info:hover { background: #075985; color: var(--white); }

.btn-secondary { background: #6b7280; color: var(--white); border-color: #6b7280; }
.btn-secondary:hover { background: #4b5563; border-color: #4b5563; color: var(--white); }

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: var(--white); }

.btn-light { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--bg); }

.btn-xs  { padding: 3px 8px; font-size: 11px; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 15px; }

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-group { margin-bottom: 14px; }

label, .form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.form-control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"], textarea, select {
    display: block;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition);
    line-height: 1.4;
}
.form-control:focus, input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="number"]:focus, input[type="date"]:focus,
input[type="tel"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-control:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
.input-group-text {
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ══════════════════════════════════════
   BADGES & STATUS
══════════════════════════════════════ */
.badge, .status-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius);
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary, .bg-primary   { background: var(--primary);    color: var(--white); }
.badge-success, .bg-success   { background: var(--success);    color: var(--white); }
.badge-danger,  .bg-danger    { background: var(--danger);     color: var(--white); }
.badge-warning, .bg-warning   { background: var(--warning);    color: var(--white); }
.badge-info,    .bg-info      { background: var(--info);       color: var(--white); }
.badge-secondary              { background: #6b7280;           color: var(--white); }
.badge-light                  { background: var(--bg);         color: var(--text); border: 1px solid var(--border); }

/* Document/NLA status */
.status-0  { background: var(--bg);          color: var(--text-muted);  border: 1px solid var(--border); }
.status-1  { background: var(--warning-bg);  color: var(--warning); }
.status-2  { background: var(--info-bg);     color: var(--info); }
.status-3  { background: #f3f4f6;            color: #374151; }
.status-4  { background: var(--danger-bg);   color: var(--danger); }
.status-5  { background: var(--success-bg);  color: var(--success); }
.status-6  { background: #ede9fe;            color: #5b21b6; }
.status-7  { background: var(--primary-dim); color: var(--primary); }
.status-active   { background: var(--success-bg); color: var(--success); }
.status-inactive { background: var(--danger-bg);  color: var(--danger); }
.status-pending  { background: var(--warning-bg); color: var(--warning); }

/* ══════════════════════════════════════
   ALERTS
══════════════════════════════════════ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    border-left: 3px solid;
    margin-bottom: 14px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: #14532d; }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: #7f1d1d; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: #78350f; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: #0c4a6e; }

/* ══════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    pointer-events: all;
    animation: toastIn 0.2s ease;
    min-width: 240px;
    max-width: 340px;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger  { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast i { font-size: 15px; }
.toast.toast-success i { color: var(--success); }
.toast.toast-danger  i { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════
   MODALS / DIALOGS
══════════════════════════════════════ */
.modal-overlay, .dialog {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.modal-overlay.active, .dialog.active { display: flex; }

.modal, .dialog-content {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header, .dialog-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3, .modal-header h4 { font-size: 15px; font-weight: 600; margin: 0; color: var(--white); }
.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius);
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: var(--white); }

.modal-body, .dialog-body { padding: 16px; }
.modal-footer, .dialog-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ══════════════════════════════════════
   PAGINATION
══════════════════════════════════════ */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    margin: 16px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span, .page-link {
    display: inline-block;
    padding: 6px 11px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--primary);
    background: var(--white);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.pagination a:hover, .page-link:hover { background: var(--primary-dim); }
.pagination .active, .page-item.active .page-link {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.pagination li { list-style: none; }

/* ══════════════════════════════════════
   FORMS SLIDE PANEL (right drawer)
══════════════════════════════════════ */
.forms-container {
    position: fixed;
    right: -360px;
    width: 340px;
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--border);
    top: 0;
    z-index: 1100;
    transition: right var(--transition);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.forms-container.right-0 { right: 0; }
@media (max-width: 768px) { .forms-container { width: 100%; right: -100%; } }

/* ══════════════════════════════════════
   LOADER OVERLAY
══════════════════════════════════════ */
#ec-overlay {
    position: fixed;
    inset: 0;
    background: #0a1628;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity .55s cubic-bezier(.4,0,.2,1);
}
#ec-overlay.ec-hide { opacity: 0; pointer-events: none; }

/* ══════════════════════════════════════
   MONEY / AMOUNT display
══════════════════════════════════════ */
.money {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.money::before { content: 'Frw '; font-weight: 400; color: var(--text-muted); font-size: 11px; }
.money-positive { color: var(--success); }
.money-negative { color: var(--danger); }
.money-neutral  { color: var(--text); }

/* ══════════════════════════════════════
   UTILITIES
══════════════════════════════════════ */
.d-none       { display: none !important; }
.d-flex       { display: flex; }
.d-grid       { display: grid; }
.d-block      { display: block; }
.flex-column  { flex-direction: column; }
.flex-row     { flex-direction: row; }
.align-center { align-items: center; }
.justify-between  { justify-content: space-between; }
.justify-center   { justify-content: center; }
.justify-end      { justify-content: flex-end; }
.space-around     { justify-content: space-around; }
.flex-wrap    { flex-wrap: wrap; }
.flex-fill    { flex: 1; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.w-100 { width: 100%; }
.w-75  { width: 75%; }
.w-50  { width: 50%; }
.w-25  { width: 25%; }

.mt-0 { margin-top: 0; }   .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 4px; } .mb-1 { margin-bottom: 4px; }
.mt-2 { margin-top: 8px; } .mb-2 { margin-bottom: 8px; }
.mt-3 { margin-top: 12px;} .mb-3 { margin-bottom: 12px;}
.mt-4 { margin-top: 16px;} .mb-4 { margin-bottom: 16px;}
.mt-5 { margin-top: 20px;} .mb-5 { margin-bottom: 20px;}

.mt-10 { margin-top: 10px; } .mb-10 { margin-bottom: 10px; }
.mt-20 { margin-top: 20px; } .mb-20 { margin-bottom: 20px; }
.mt-30 { margin-top: 30px; } .mb-30 { margin-bottom: 30px; }
.mt-n5 { margin-top: -5%; } .mt-n4 { margin-top: -4%; } .mt-n2 { margin-top: -2%; }
.ml-2  { margin-left: 2%;  } .ml-5  { margin-left: 5%; }
.ml-70 { margin-left: 70%; }
.mr-10 { margin-right: 10px; } .mr-15 { margin-right: 15px; }

.p-0  { padding: 0; }
.p-4  { padding: 4px; }
.p-8  { padding: 8px; }
.p-10 { padding: 10px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.text-left    { text-align: left; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-end     { text-align: end; }
.text-uppercase { text-transform: uppercase; }
.text-capitalize { text-transform: capitalize; }
.text-bold    { font-weight: 600 !important; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-muted   { color: var(--text-muted); }
.text-dark    { color: var(--text); }
.text-white   { color: var(--white); }

.bg-white     { background: var(--white); }
.bg-light     { background: var(--bg); }
.bg-primary   { background: var(--primary); color: var(--white); }
.bg-side      { background: var(--primary); }

.fs-10 { font-size: 10px; }
.fs-12 { font-size: 12px; }

.border-b  { border-bottom: 1px solid var(--border); }
.border    { border: 1px solid var(--border); }

.text-ellipsed {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
    vertical-align: bottom;
}
.long-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    display: inline-block;
}

.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.col { flex: 1; padding: 0 8px; }

@media (min-width: 992px) {
    .col-md-4 { width: 33.333%; padding: 0 8px; }
    .col-md-6 { width: 50%;     padding: 0 8px; }
    .col-md-8 { width: 66.666%; padding: 0 8px; }
    .col-md-12{ width: 100%;    padding: 0 8px; }
}

/* Close button (×) */
.close {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    border-radius: var(--radius);
    padding: 2px 8px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.4;
}
.close:hover { background: var(--danger); color: var(--white); }

/* Grid helpers kept for compat */
.display-grid  { display: grid; }
.d-grid-6  { grid-template-columns: 300px 100px 150px 1fr 50px; gap: 10px; display: grid; }
.d-grid-6_ { grid-template-columns: 30px 300px 100px 100px 1fr 1fr; gap: 10px; display: grid; }
.d-grid-all{ grid-template-columns: 30px 350px 100px 1fr 100px; gap: 10px; display: grid; }

/* Doc detail lines */
.doc-details-p {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

/* Status classes for expiry alerts */
._bg-danger  { color: var(--danger);  background: var(--danger-bg);  border: 1px solid #fca5a5; padding: 2px 7px; border-radius: var(--radius); font-weight: 600; }
._bg-warning { color: var(--warning); background: var(--warning-bg); border: 1px solid #fcd34d; padding: 2px 7px; border-radius: var(--radius); font-weight: 600; }
._bg-success { color: var(--success); background: var(--success-bg); border: 1px solid #86efac; padding: 2px 7px; border-radius: var(--radius); font-weight: 600; }
._bg-normal  { color: var(--text);    background: transparent; padding: 2px 7px; }

/* Sub paid/unpaid badge compat */
.sub  { background: var(--warning-bg); color: var(--warning); }
.paid { background: var(--success-bg); color: var(--success); }

/* Table wrapper compat */
.table-container.card-grid-wrapper { overflow: visible; }
.overflow { overflow: auto; }

/* Desk link */
.desk-link { color: var(--text); font-size: 15px; }

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════ */
@media (max-width: 768px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .forms-container { width: 100% !important; }
    .w-25 { width: 100% !important; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .data-table thead th, table.table thead th { font-size: 11px; padding: 8px; }
    .data-table tbody td, table.table tbody td { font-size: 12px; padding: 8px; }
}
@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr; }
    .btn { font-size: 12px; padding: 6px 10px; }
}
