/* ── Base ── */
* { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }

/* ── Active Nav ── */
.nav-link.active,
.nav-link:hover {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* ── Table ── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
}
.data-table tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: #f8fafc; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-active   { background: #dcfce7; color: #166534; }
.badge-expired  { background: #fee2e2; color: #991b1b; }
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-completed{ background: #dcfce7; color: #166534; }
.badge-ongoing  { background: #dbeafe; color: #1e40af; }
.badge-on_hold  { background: #fef9c3; color: #854d0e; }
.badge-cancelled{ background: #f1f5f9; color: #475569; }
.badge-suspended{ background: #fee2e2; color: #991b1b; }
.badge-grace    { background: #ffedd5; color: #9a3412; }
.badge-rescheduled { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-done     { background: #dcfce7; color: #166534; }
.badge-urgent   { background: #fee2e2; color: #991b1b; }
.badge-high     { background: #ffedd5; color: #9a3412; }
.badge-medium   { background: #fef9c3; color: #854d0e; }
.badge-low      { background: #f1f5f9; color: #475569; }

/* ── Action Buttons ── */
.btn-action {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    font-size: 14px;
}
.btn-edit   { background: #eff6ff; color: #2563eb; }
.btn-edit:hover   { background: #2563eb; color: #fff; }
.btn-delete { background: #fef2f2; color: #dc2626; }
.btn-delete:hover { background: #dc2626; color: #fff; }
.btn-view   { background: #f0fdf4; color: #16a34a; }
.btn-view:hover   { background: #16a34a; color: #fff; }

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.card-body { padding: 0; }

/* ── Form ── */
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.15s;
    outline: none;
}
.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input,
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
    min-width: 140px;
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}
.modal-box {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Toast Animation ── */
#toast { transition: all 0.3s ease; transform: translateY(20px); opacity: 0; }
#toast.show { transform: translateY(0); opacity: 1; }

/* ── Expiry highlight ── */
.row-expiring { background: #fffbeb !important; }
.row-expired  { background: #fef2f2 !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .filter-bar { flex-direction: column; }
    .filter-bar input, .filter-bar select { width: 100%; }
    .data-table { font-size: 12px; }
    .data-table thead th, .data-table tbody td { padding: 8px 10px; }
}